aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNathan Guse <nathaniel.guse@gmail.com>2012-09-12 22:38:23 -0500
committerNathan Guse <nathaniel.guse@gmail.com>2012-09-12 22:38:23 -0500
commit48cb98045ecd93f05b51aa528cc5248493b47c98 (patch)
tree3b2992a9b0c9d52a1071375430f898cca5792c87
parent3d1549d43f42631c7be8d90a1f215db239baac92 (diff)
downloadforums-48cb98045ecd93f05b51aa528cc5248493b47c98.tar
forums-48cb98045ecd93f05b51aa528cc5248493b47c98.tar.gz
forums-48cb98045ecd93f05b51aa528cc5248493b47c98.tar.bz2
forums-48cb98045ecd93f05b51aa528cc5248493b47c98.tar.xz
forums-48cb98045ecd93f05b51aa528cc5248493b47c98.zip
[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
-rw-r--r--phpBB/includes/notifications/type/post.php2
-rw-r--r--phpBB/includes/notifications/type/topic.php17
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')}&amp;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);
}
}