mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 22:28:51 +00:00
[ticket/11103] Use the Topic/Forum Subscriptions system
Using the Topic/Forum Subscription system that already exists is going to save many hours of work. If it is desired, it can always be easily converted over to the new USER_NOTIFICATIONS_TABLE later (for the same amount of work). PHPBB3-11103
This commit is contained in:
parent
9b1de1e487
commit
e145956212
2 changed files with 28 additions and 4 deletions
|
@ -54,9 +54,21 @@ class phpbb_notifications_type_post extends phpbb_notifications_type_base
|
||||||
*/
|
*/
|
||||||
public static function find_users_for_notification(ContainerBuilder $phpbb_container, $post)
|
public static function find_users_for_notification(ContainerBuilder $phpbb_container, $post)
|
||||||
{
|
{
|
||||||
$users = parent::_find_users_for_notification($phpbb_container, $post['topic_id']);
|
// Let's continue to use the phpBB subscriptions system, at least for now.
|
||||||
|
// It may not be the nicest thing, but it is already working and it would be significant work to replace it
|
||||||
|
//$users = parent::_find_users_for_notification($phpbb_container, $post['topic_id']);
|
||||||
|
|
||||||
if (!sizeof($users))
|
$db = $phpbb_container->get('dbal.conn');
|
||||||
|
|
||||||
|
$sql = 'SELECT user_id
|
||||||
|
FROM ' . TOPICS_WATCH_TABLE . '
|
||||||
|
WHERE topic_id = ' . (int) $post['topic_id'] . '
|
||||||
|
AND notify_status = ' . NOTIFY_YES;
|
||||||
|
$result = $db->sql_query($sql);
|
||||||
|
$users = $db->sql_fetchrowset($result);
|
||||||
|
$db->sql_freeresult($result);
|
||||||
|
|
||||||
|
if (empty($users))
|
||||||
{
|
{
|
||||||
return array();
|
return array();
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,9 +54,21 @@ class phpbb_notifications_type_topic extends phpbb_notifications_type_base
|
||||||
*/
|
*/
|
||||||
public static function find_users_for_notification(ContainerBuilder $phpbb_container, $topic)
|
public static function find_users_for_notification(ContainerBuilder $phpbb_container, $topic)
|
||||||
{
|
{
|
||||||
$users = parent::_find_users_for_notification($phpbb_container, $topic['forum_id']);
|
// Let's continue to use the phpBB subscriptions system, at least for now.
|
||||||
|
// It may not be the nicest thing, but it is already working and it would be significant work to replace it
|
||||||
|
//$users = parent::_find_users_for_notification($phpbb_container, $topic['forum_id']);
|
||||||
|
|
||||||
if (!sizeof($users))
|
$db = $phpbb_container->get('dbal.conn');
|
||||||
|
|
||||||
|
$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);
|
||||||
|
$db->sql_freeresult($result);
|
||||||
|
|
||||||
|
if (empty($users))
|
||||||
{
|
{
|
||||||
return array();
|
return array();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue