[ticket/11103] Bots/Anonymous never receive notifications

Do not waste queries trying to load notifications for these users

PHPBB3-11103
This commit is contained in:
Nathan Guse 2012-09-15 11:59:30 -05:00
parent aaf6711b44
commit a1e2fb93ad

View file

@ -66,6 +66,12 @@ class phpbb_notifications_service
'all_unread' => true, 'all_unread' => true,
), $options); ), $options);
// Anonymous users and bots never receive notifications
if ($options['user_id'] == $user->data['user_id'] && ($user->data['user_id'] == ANONYMOUS || $user->data['user_type'] == USER_IGNORE))
{
return;
}
$notifications = $user_ids = array(); $notifications = $user_ids = array();
$load_special = array(); $load_special = array();
@ -94,7 +100,7 @@ class phpbb_notifications_service
$this->db->sql_freeresult($result); $this->db->sql_freeresult($result);
// Get all unread notifications // Get all unread notifications
if ($options['all_unread']) if ($options['all_unread'] && !empty($rowset))
{ {
$sql = 'SELECT * $sql = 'SELECT *
FROM ' . NOTIFICATIONS_TABLE . ' FROM ' . NOTIFICATIONS_TABLE . '