From 48cb98045ecd93f05b51aa528cc5248493b47c98 Mon Sep 17 00:00:00 2001 From: Nathan Guse Date: Wed, 12 Sep 2012 22:38:23 -0500 Subject: [PATCH] [ticket/11103] Correctly find users for notification for new topics Append the forum_id to the URL to view the new topic in the notification PHPBB3-11103 --- phpBB/includes/notifications/type/post.php | 2 ++ phpBB/includes/notifications/type/topic.php | 17 ++++++++++++++--- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/phpBB/includes/notifications/type/post.php b/phpBB/includes/notifications/type/post.php index 23358599a1..4fd4128168 100644 --- a/phpBB/includes/notifications/type/post.php +++ b/phpBB/includes/notifications/type/post.php @@ -60,6 +60,8 @@ class phpbb_notifications_type_post extends phpbb_notifications_type_base $db = $phpbb_container->get('dbal.conn'); + $users = array(); + /* todo * find what type of notification they'd like to receive * make sure not to send duplicate notifications diff --git a/phpBB/includes/notifications/type/topic.php b/phpBB/includes/notifications/type/topic.php index 58a3740e3a..209d23b823 100644 --- a/phpBB/includes/notifications/type/topic.php +++ b/phpBB/includes/notifications/type/topic.php @@ -60,12 +60,21 @@ class phpbb_notifications_type_topic extends phpbb_notifications_type_base $db = $phpbb_container->get('dbal.conn'); + $users = array(); + + /* todo + * find what type of notification they'd like to receive + * make sure not to send duplicate notifications + */ $sql = 'SELECT user_id FROM ' . FORUMS_WATCH_TABLE . ' WHERE forum_id = ' . (int) $topic['forum_id'] . ' AND notify_status = ' . NOTIFY_YES; $result = $db->sql_query($sql); - $users = $db->sql_fetchrowset($result); + while ($row = $db->sql_fetchrow($result)) + { + $users[$row['user_id']] = array(''); + } $db->sql_freeresult($result); if (empty($users)) @@ -157,7 +166,7 @@ class phpbb_notifications_type_topic extends phpbb_notifications_type_base */ public function get_url() { - return append_sid($this->phpbb_root_path . 'viewtopic.' . $this->php_ext, "t={$this->item_id}"); + return append_sid($this->phpbb_root_path . 'viewtopic.' . $this->php_ext, "f={$this->get_data('forum_id')}&t={$this->item_id}"); } /** @@ -167,7 +176,7 @@ class phpbb_notifications_type_topic extends phpbb_notifications_type_base */ public function get_full_url() { - return generate_board_url() . "/viewtopic.{$this->php_ext}?t={$this->item_id}"; + return generate_board_url() . "/viewtopic.{$this->php_ext}?f={$this->get_data('forum_id')}&t={$this->item_id}"; } /** @@ -200,6 +209,8 @@ class phpbb_notifications_type_topic extends phpbb_notifications_type_base $this->set_data('forum_name', $post['forum_name']); + $this->set_data('forum_id', $post['forum_id']); + return parent::create_insert_array($post); } }