diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html
index 2ec2979527..896d52b6be 100644
--- a/phpBB/docs/CHANGELOG.html
+++ b/phpBB/docs/CHANGELOG.html
@@ -113,6 +113,7 @@
[Fix] Template cache error for files of template-subfolders (Bug #46145 - Patch by nickvergessen)
[Fix] Display user's Jabber address in popup when Jabber functionality is disabled (Bug #20775 - Patch by nickvergessen)
[Fix] Exclude forum from active topics option is ignored (Bug #19135 - Patch by nickvergessen)
+ [Fix] Do not display birthdays of banned users (Bug #20625 - Patch by nickvergessen)
[Change] Change the data format of the default file ACM to be more secure from tampering and have better performance.
[Change] Add index on log_time to the log table to prevent slowdown on boards with many log entries. (Bug #44665 - Patch by bantu)
[Change] Template engine now permits to a limited extent variable includes.
diff --git a/phpBB/index.php b/phpBB/index.php
index 2d1329c511..9dffade44c 100644
--- a/phpBB/index.php
+++ b/phpBB/index.php
@@ -84,10 +84,12 @@ $birthday_list = '';
if ($config['load_birthdays'] && $config['allow_birthdays'])
{
$now = getdate(time() + $user->timezone + $user->dst - date('Z'));
- $sql = 'SELECT user_id, username, user_colour, user_birthday
- FROM ' . USERS_TABLE . "
- WHERE user_birthday LIKE '" . $db->sql_escape(sprintf('%2d-%2d-', $now['mday'], $now['mon'])) . "%'
- AND user_type IN (" . USER_NORMAL . ', ' . USER_FOUNDER . ')';
+ $sql = 'SELECT u.user_id, u.username, u.user_colour, u.user_birthday, b.ban_id
+ FROM ' . USERS_TABLE . ' u
+ LEFT JOIN ' . BANLIST_TABLE . " b ON (u.user_id = b.ban_userid)
+ WHERE b.ban_id IS NULL
+ AND u.user_birthday LIKE '" . $db->sql_escape(sprintf('%2d-%2d-', $now['mday'], $now['mon'])) . "%'
+ AND u.user_type IN (" . USER_NORMAL . ', ' . USER_FOUNDER . ')';
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result))