aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB
diff options
context:
space:
mode:
authorNathan Guse <nathaniel.guse@gmail.com>2012-09-12 21:23:24 -0500
committerNathan Guse <nathaniel.guse@gmail.com>2012-09-12 21:23:24 -0500
commite14595621259edb093a8bb984a95747ede2041ff (patch)
tree499277edc9e590b0830ebc7dd7e5dad4f27290c3 /phpBB
parent9b1de1e487e162f55085ce72e660c5b348615649 (diff)
downloadforums-e14595621259edb093a8bb984a95747ede2041ff.tar
forums-e14595621259edb093a8bb984a95747ede2041ff.tar.gz
forums-e14595621259edb093a8bb984a95747ede2041ff.tar.bz2
forums-e14595621259edb093a8bb984a95747ede2041ff.tar.xz
forums-e14595621259edb093a8bb984a95747ede2041ff.zip
[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
Diffstat (limited to 'phpBB')
-rw-r--r--phpBB/includes/notifications/type/post.php16
-rw-r--r--phpBB/includes/notifications/type/topic.php16
2 files changed, 28 insertions, 4 deletions
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();
}