diff options
author | Andreas Fischer <bantu@phpbb.com> | 2011-05-08 15:24:03 +0200 |
---|---|---|
committer | Andreas Fischer <bantu@phpbb.com> | 2011-05-08 15:36:27 +0200 |
commit | 2f458352b8660386021af6868dcec75943bb8483 (patch) | |
tree | a13c6639b7c6c4319308c39e6e8eb7b2c3d5f5ee /phpBB/index.php | |
parent | Merge remote-tracking branch 'p/ticket/9693' into develop (diff) | |
download | phpbb-2f458352b8660386021af6868dcec75943bb8483.tar.gz phpbb-2f458352b8660386021af6868dcec75943bb8483.tar.bz2 phpbb-2f458352b8660386021af6868dcec75943bb8483.zip |
[ticket/10173] Use a loop var for the birthdays list to allow proper templating
Introduce a loop variable for the list of birthdays to allow templates to
handle how the list is displayed.
We keep the old BIRTHDAY_LIST variable that contains the precompiled list
around for backward compatibility.
PHPBB3-10173
Diffstat (limited to 'phpBB/index.php')
-rw-r--r-- | phpBB/index.php | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/phpBB/index.php b/phpBB/index.php index 0830dd0686..e5dceeacf2 100644 --- a/phpBB/index.php +++ b/phpBB/index.php @@ -96,12 +96,20 @@ if ($config['load_birthdays'] && $config['allow_birthdays']) while ($row = $db->sql_fetchrow($result)) { - $birthday_list .= (($birthday_list != '') ? ', ' : '') . get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']); + $birthday_username = get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']); + $birthday_list .= (($birthday_list != '') ? ', ' : '') . $birthday_username; + $birthday_year = (int) substr($row['user_birthday'], -4); + $birthday_age = $now['year'] - $birthday_year; - if ($age = (int) substr($row['user_birthday'], -4)) + if ($birthday_year) { - $birthday_list .= ' (' . ($now['year'] - $age) . ')'; + $birthday_list .= ' (' . $birthday_age . ')'; } + + $template->assign_block_vars('birthdays', array( + 'USERNAME' => $birthday_username, + 'AGE' => ($birthday_year) ? $birthday_age : '', + )); } $db->sql_freeresult($result); } |