aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/notification/manager.php
diff options
context:
space:
mode:
authorNathan Guse <nathaniel.guse@gmail.com>2012-10-13 23:24:30 -0500
committerNathan Guse <nathaniel.guse@gmail.com>2012-10-13 23:24:30 -0500
commit94ffbb4050b2985ee62be0ecc0c6a244532e43ca (patch)
treeb6682a9080b6cf5c35cee14b10d2f4a42085fe31 /phpBB/includes/notification/manager.php
parentcb937841269017d13058208378e4c9ad79718c6e (diff)
downloadforums-94ffbb4050b2985ee62be0ecc0c6a244532e43ca.tar
forums-94ffbb4050b2985ee62be0ecc0c6a244532e43ca.tar.gz
forums-94ffbb4050b2985ee62be0ecc0c6a244532e43ca.tar.bz2
forums-94ffbb4050b2985ee62be0ecc0c6a244532e43ca.tar.xz
forums-94ffbb4050b2985ee62be0ecc0c6a244532e43ca.zip
[ticket/11103] Add is_disabled column to notifications table
EXTENSION AUTHORS TAKE NOTE! This is to prevent errors with notifications from extensions! Set is_disabled to 1 for all your notifications when your extension is disabled so they are ignored and do not cause errors. When your extension is enabled again, set is_disabled to 0 and your notifications will be working again. PHPBB3-11103
Diffstat (limited to 'phpBB/includes/notification/manager.php')
-rw-r--r--phpBB/includes/notification/manager.php15
1 files changed, 10 insertions, 5 deletions
diff --git a/phpBB/includes/notification/manager.php b/phpBB/includes/notification/manager.php
index 22fa12967a..16fdae6dd0 100644
--- a/phpBB/includes/notification/manager.php
+++ b/phpBB/includes/notification/manager.php
@@ -94,7 +94,8 @@ class phpbb_notification_manager
$sql = 'SELECT COUNT(*) AS count
FROM ' . NOTIFICATIONS_TABLE . '
WHERE user_id = ' . (int) $options['user_id'] . '
- AND unread = 1';
+ AND unread = 1
+ AND is_disabled = 0';
$result = $this->db->sql_query($sql);
$unread_count = (int) $this->db->sql_fetchfield('count', $result);
$this->db->sql_freeresult($result);
@@ -105,7 +106,8 @@ class phpbb_notification_manager
// Get the total number of notifications
$sql = 'SELECT COUNT(*) AS count
FROM ' . NOTIFICATIONS_TABLE . '
- WHERE user_id = ' . (int) $options['user_id'];
+ WHERE user_id = ' . (int) $options['user_id'] . '
+ AND is_disabled = 0';
$result = $this->db->sql_query($sql);
$total_count = (int) $this->db->sql_fetchfield('count', $result);
$this->db->sql_freeresult($result);
@@ -118,7 +120,8 @@ class phpbb_notification_manager
FROM ' . NOTIFICATIONS_TABLE . '
WHERE user_id = ' . (int) $options['user_id'] .
(($options['notification_id']) ? ((is_array($options['notification_id'])) ? ' AND ' . $this->db->sql_in_set('notification_id', $options['notification_id']) : ' AND notification_id = ' . (int) $options['notification_id']) : '') . '
- ORDER BY ' . $this->db->sql_escape($options['order_by']) . ' ' . $this->db->sql_escape($options['order_dir']);
+ AND is_disabled = 0
+ ORDER BY ' . $this->db->sql_escape($options['order_by']) . ' ' . $this->db->sql_escape($options['order_dir']);
$result = $this->db->sql_query_limit($sql, $options['limit'], $options['start']);
while ($row = $this->db->sql_fetchrow($result))
@@ -135,7 +138,8 @@ class phpbb_notification_manager
WHERE user_id = ' . (int) $options['user_id'] . '
AND unread = 1
AND ' . $this->db->sql_in_set('notification_id', array_keys($rowset), true) . '
- ORDER BY ' . $this->db->sql_escape($options['order_by']) . ' ' . $this->db->sql_escape($options['order_dir']);
+ AND is_disabled = 0
+ ORDER BY ' . $this->db->sql_escape($options['order_by']) . ' ' . $this->db->sql_escape($options['order_dir']);
$result = $this->db->sql_query_limit($sql, $options['limit'], $options['start']);
while ($row = $this->db->sql_fetchrow($result))
@@ -344,7 +348,8 @@ class phpbb_notification_manager
$sql = 'SELECT user_id
FROM ' . NOTIFICATIONS_TABLE . "
WHERE item_type = '" . $this->db->sql_escape($item_type) . "'
- AND item_id = " . (int) $item_id;
+ AND item_id = " . (int) $item_id . '
+ AND is_disabled = 0';
$result = $this->db->sql_query($sql);
while ($row = $this->db->sql_fetchrow($result))
{