diff --git a/phpBB/includes/notifications/type/post.php b/phpBB/includes/notifications/type/post.php index 3568b9d478..b951b79fa6 100644 --- a/phpBB/includes/notifications/type/post.php +++ b/phpBB/includes/notifications/type/post.php @@ -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) { - $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(); } diff --git a/phpBB/includes/notifications/type/topic.php b/phpBB/includes/notifications/type/topic.php index 51a95d5e19..58a3740e3a 100644 --- a/phpBB/includes/notifications/type/topic.php +++ b/phpBB/includes/notifications/type/topic.php @@ -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) { - $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(); }