diff options
Diffstat (limited to 'phpBB/includes/functions_privmsgs.php')
| -rw-r--r-- | phpBB/includes/functions_privmsgs.php | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/phpBB/includes/functions_privmsgs.php b/phpBB/includes/functions_privmsgs.php index ba939d490e..57c872d91a 100644 --- a/phpBB/includes/functions_privmsgs.php +++ b/phpBB/includes/functions_privmsgs.php @@ -1884,6 +1884,7 @@ function pm_notification($mode, $author, $recipients, $subject, $message, $msg_i return; } + // Get currently banned users (do not notify these users) if (!function_exists('phpbb_get_banned_user_ids')) { include($phpbb_root_path . 'includes/functions_user.' . $phpEx); @@ -1891,12 +1892,18 @@ function pm_notification($mode, $author, $recipients, $subject, $message, $msg_i $banned_users = phpbb_get_banned_user_ids(array_keys($recipients)); $recipients = array_diff(array_keys($recipients), $banned_users); + // Get the list of users who can read PMs (only notify those who can read PMs) + $can_read = $auth->acl_get_list($recipients, 'u_readpm'); + $can_read = (empty($can_read) || !isset($can_read[0]['u_readpm'])) ? array() : $can_read[0]['u_readpm']; + $recipients = array_intersect($recipients, $can_read); + if (!sizeof($recipients)) { return; } - $sql = 'SELECT user_id, username, user_email, user_lang, user_notify_pm, user_notify_type, user_jabber + // Get the list of users who want to receive notifications, are "normal" and not deactivated, and have a non-blank email address + $sql = 'SELECT user_id, username, user_type, user_inactive_reason, user_email, user_lang, user_notify_pm, user_notify_type, user_jabber FROM ' . USERS_TABLE . ' WHERE ' . $db->sql_in_set('user_id', $recipients); $result = $db->sql_query($sql); @@ -1904,7 +1911,7 @@ function pm_notification($mode, $author, $recipients, $subject, $message, $msg_i $msg_list_ary = array(); while ($row = $db->sql_fetchrow($result)) { - if ($row['user_notify_pm'] == 1 && trim($row['user_email'])) + if ($row['user_notify_pm'] == 1 && $row['user_type'] != USER_IGNORE && !($row['user_type'] == USER_INACTIVE && $row['user_inactive_reason'] == INACTIVE_MANUAL) && trim($row['user_email'])) { $msg_list_ary[] = array( 'method' => $row['user_notify_type'], |
