aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNathaniel Guse <nathaniel.guse@gmail.com>2012-10-13 18:12:33 -0500
committerNathaniel Guse <nathaniel.guse@gmail.com>2012-10-13 18:12:33 -0500
commit39fd31d3aedd5d583041b1ee76bed3e7d0edcf36 (patch)
tree91287a4b8746059afbc93a043219b92c9170bae5
parentc60b15294a72d5a2be8e7d23fd1b4052ec944ec8 (diff)
downloadforums-39fd31d3aedd5d583041b1ee76bed3e7d0edcf36.tar
forums-39fd31d3aedd5d583041b1ee76bed3e7d0edcf36.tar.gz
forums-39fd31d3aedd5d583041b1ee76bed3e7d0edcf36.tar.bz2
forums-39fd31d3aedd5d583041b1ee76bed3e7d0edcf36.tar.xz
forums-39fd31d3aedd5d583041b1ee76bed3e7d0edcf36.zip
[ticket/11103] Trying to fix an odd issue with unread status on approved posts
From a recent change, when your posts/topics are approved, they will be marked read automatically because you've read the topic/post already. To change that I've forced the notification to be marked unread and attempted to reset the read status on the post/topic to be unread before the post that was approved. This does not seem to work so well and I don't know of any way this can really be properly fixed, so the code I was working on I've commented out. For now, users will just need to manually mark these types of notifications as read. I cannot think of a way for this to be fixed without running two additional queries on every viewtopic. PHPBB3-11103
-rw-r--r--phpBB/includes/notification/type/approve_post.php32
-rw-r--r--phpBB/includes/notification/type/approve_topic.php30
2 files changed, 62 insertions, 0 deletions
diff --git a/phpBB/includes/notification/type/approve_post.php b/phpBB/includes/notification/type/approve_post.php
index dbd2e4417f..68e8352a13 100644
--- a/phpBB/includes/notification/type/approve_post.php
+++ b/phpBB/includes/notification/type/approve_post.php
@@ -115,6 +115,38 @@ class phpbb_notification_type_approve_post extends phpbb_notification_type_post
}
/**
+ * Pre create insert array function
+ * This allows you to perform certain actions, like run a query
+ * and load data, before create_insert_array() is run. The data
+ * returned from this function will be sent to create_insert_array().
+ *
+ * @param array $post Post data from submit_post
+ * @param array $notify_users Notify users list
+ * Formated from find_users_for_notification()
+ * @return array Whatever you want to send to create_insert_array().
+ */
+ public function pre_create_insert_array($post, $notify_users)
+ {
+ /*if (!sizeof($notify_users))
+ {
+ return array();
+ }
+
+ // Mark the topic unread before the post
+ $sql = 'UPDATE ' . TOPICS_TRACK_TABLE . '
+ SET mark_time = ' . (int) ($post['post_time'] - 1) . '
+ WHERE topic_id = ' . (int) $post['topic_id'] . '
+ AND ' . $this->db->sql_in_set('user_id', array_keys($notify_users));
+ $this->db->sql_query($sql);*/
+
+ // In the parent class, this is used to check if the post is already
+ // read by a user and marks the notification read if it was marked read.
+ // Returning an empty array in effect, forces it to be marked as unread
+ // (and also saves a query)
+ return array();
+ }
+
+ /**
* Function for preparing the data for insertion in an SQL query
* (The service handles insertion)
*
diff --git a/phpBB/includes/notification/type/approve_topic.php b/phpBB/includes/notification/type/approve_topic.php
index 3608bfba85..f3a94e44b8 100644
--- a/phpBB/includes/notification/type/approve_topic.php
+++ b/phpBB/includes/notification/type/approve_topic.php
@@ -115,6 +115,36 @@ class phpbb_notification_type_approve_topic extends phpbb_notification_type_topi
}
/**
+ * Pre create insert array function
+ * This allows you to perform certain actions, like run a query
+ * and load data, before create_insert_array() is run. The data
+ * returned from this function will be sent to create_insert_array().
+ *
+ * @param array $post Post data from submit_post
+ * @param array $notify_users Notify users list
+ * Formated from find_users_for_notification()
+ * @return array Whatever you want to send to create_insert_array().
+ */
+ public function pre_create_insert_array($post, $notify_users)
+ {
+ /*if (!sizeof($notify_users))
+ {
+ return array();
+ }
+
+ // Mark the topic unread
+ $sql = 'DELETE FROM ' . TOPICS_TRACK_TABLE . '
+ WHERE topic_id = ' . (int) $post['topic_id'] . '
+ AND ' . $this->db->sql_in_set('user_id', array_keys($notify_users));
+ $this->db->sql_query($sql*/
+
+ // In the parent class, this is used to check if the post is already
+ // read by a user and marks the notification read if it was marked read.
+ // Returning an empty array in effect, forces it to be marked as unread
+ return array();
+ }
+
+ /**
* Function for preparing the data for insertion in an SQL query
* (The service handles insertion)
*