aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/notification/manager.php
diff options
context:
space:
mode:
authorNathan Guse <nathaniel.guse@gmail.com>2012-10-12 16:54:42 -0500
committerNathan Guse <nathaniel.guse@gmail.com>2012-10-12 16:54:42 -0500
commit3d79ce28031b4c85ee34bd4d43f0c64b18b1a80b (patch)
treeb6a440791b0ea08e5d91246ee5a2ab352ae260e6 /phpBB/includes/notification/manager.php
parent8b2f1127e4167e241c41f8709964c203e401de94 (diff)
downloadforums-3d79ce28031b4c85ee34bd4d43f0c64b18b1a80b.tar
forums-3d79ce28031b4c85ee34bd4d43f0c64b18b1a80b.tar.gz
forums-3d79ce28031b4c85ee34bd4d43f0c64b18b1a80b.tar.bz2
forums-3d79ce28031b4c85ee34bd4d43f0c64b18b1a80b.tar.xz
forums-3d79ce28031b4c85ee34bd4d43f0c64b18b1a80b.zip
[ticket/11103] Ability to query data before running create_insert_array()
Mark post/topic in queue notifications read when visiting mcp Change post/topic in queue notification url to use MCP. Fix the bug: Approving a topic marks the topic as read, but before the notification is created for the user approving the topic (if they would get a notification that the topic has been made). This causes it to be stuck "unread". PHPBB3-11103
Diffstat (limited to 'phpBB/includes/notification/manager.php')
-rw-r--r--phpBB/includes/notification/manager.php9
1 files changed, 6 insertions, 3 deletions
diff --git a/phpBB/includes/notification/manager.php b/phpBB/includes/notification/manager.php
index c5fd41c901..6c74fa965e 100644
--- a/phpBB/includes/notification/manager.php
+++ b/phpBB/includes/notification/manager.php
@@ -324,8 +324,6 @@ class phpbb_notification_manager
// Make sure not to send new notifications to users who've already been notified about this item
// This may happen when an item was added, but now new users are able to see the item
- // todo Users should not receive notifications from multiple events from the same item (ex: for a topic reply with a quote including your username)
- // Probably should be handled within each type?
$sql = 'SELECT user_id
FROM ' . NOTIFICATIONS_TABLE . "
WHERE item_type = '" . $this->db->sql_escape($item_type) . "'
@@ -342,6 +340,11 @@ class phpbb_notification_manager
return;
}
+ // Allow notifications to perform actions before creating the insert array (such as run a query to cache some data needed for all notifications)
+ $notification = $this->get_item_type_class($item_type_class_name);
+ $pre_create_data = $notification->pre_create_insert_array($data, $notify_users);
+ unset($notification);
+
// Go through each user so we can insert a row in the DB and then notify them by their desired means
foreach ($notify_users as $user => $methods)
{
@@ -350,7 +353,7 @@ class phpbb_notification_manager
$notification->user_id = (int) $user;
// Store the creation array in our new rows that will be inserted later
- $new_rows[] = $notification->create_insert_array($data);
+ $new_rows[] = $notification->create_insert_array($data, $pre_create_data);
// Users are needed to send notifications
$user_ids = array_merge($user_ids, $notification->users_to_query());