mirror of
https://github.com/phpbb/phpbb.git
synced 2025-02-24 12:03:21 +01:00
[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
This commit is contained in:
parent
3d1549d43f
commit
48cb98045e
@ -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
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user