diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html
index d2f233150a..7ba3ed9b67 100644
--- a/phpBB/docs/CHANGELOG.html
+++ b/phpBB/docs/CHANGELOG.html
@@ -141,6 +141,7 @@
[Fix] Pertain select single link on memberlist (Bug #23235 - patch provided by Schumi)
[Fix] Allow & and | in local part of email addresses (Bug #22995)
[Fix] Do not error out if php_uname function disabled / Authenticating on SMTP Server (Bug #22235 - patch by HoL)
+ [Fix] Correctly obtain to be ignored users within topic/forum notification (Bug #21795 - patch provided by dr.death)
diff --git a/phpBB/includes/functions_posting.php b/phpBB/includes/functions_posting.php
index 615c65e1ad..2f12732e8b 100644
--- a/phpBB/includes/functions_posting.php
+++ b/phpBB/includes/functions_posting.php
@@ -1121,16 +1121,15 @@ function user_notification($mode, $subject, $topic_title, $forum_name, $forum_id
// Get banned User ID's
$sql = 'SELECT ban_userid
- FROM ' . BANLIST_TABLE;
+ FROM ' . BANLIST_TABLE . '
+ WHERE ban_userid <> 0
+ AND ban_exclude <> 1';
$result = $db->sql_query($sql);
$sql_ignore_users = ANONYMOUS . ', ' . $user->data['user_id'];
while ($row = $db->sql_fetchrow($result))
{
- if (isset($row['ban_userid']))
- {
- $sql_ignore_users .= ', ' . $row['ban_userid'];
- }
+ $sql_ignore_users .= ', ' . (int) $row['ban_userid'];
}
$db->sql_freeresult($result);