mirror of
https://github.com/phpbb/phpbb.git
synced 2025-05-09 00:55:23 +02:00
Merge remote-tracking branch 'bantu/ticket/10173' into develop
* bantu/ticket/10173: [ticket/10173] Use correct variable, checking for $birthday_year was correct. [ticket/10173] Only calculate age if year is not false as per nn-. [ticket/10173] Use an array for the legacy birthday list as per rxu. [ticket/10173] Use a loop var for the birthdays list to allow proper templating
This commit is contained in:
commit
52c4726b5b
@ -81,7 +81,7 @@ $db->sql_freeresult($result);
|
||||
$legend = implode(', ', $legend);
|
||||
|
||||
// Generate birthday list if required ...
|
||||
$birthday_list = '';
|
||||
$birthday_list = array();
|
||||
if ($config['load_birthdays'] && $config['allow_birthdays'])
|
||||
{
|
||||
$now = getdate(time() + $user->timezone + $user->dst - date('Z'));
|
||||
@ -96,12 +96,17 @@ 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_year = (int) substr($row['user_birthday'], -4);
|
||||
$birthday_age = ($birthday_year) ? $now['year'] - $birthday_year : '';
|
||||
|
||||
if ($age = (int) substr($row['user_birthday'], -4))
|
||||
{
|
||||
$birthday_list .= ' (' . ($now['year'] - $age) . ')';
|
||||
}
|
||||
$template->assign_block_vars('birthdays', array(
|
||||
'USERNAME' => $birthday_username,
|
||||
'AGE' => $birthday_age,
|
||||
));
|
||||
|
||||
// For 3.0 compatibility
|
||||
$birthday_list[] = $birthday_username . (($birthday_year) ? ' (' . $birthday_age . ')' : '');
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
}
|
||||
@ -114,7 +119,7 @@ $template->assign_vars(array(
|
||||
'NEWEST_USER' => sprintf($user->lang['NEWEST_USER'], get_username_string('full', $config['newest_user_id'], $config['newest_username'], $config['newest_user_colour'])),
|
||||
|
||||
'LEGEND' => $legend,
|
||||
'BIRTHDAY_LIST' => $birthday_list,
|
||||
'BIRTHDAY_LIST' => (empty($birthday_list)) ? '' : implode(', ', $birthday_list),
|
||||
|
||||
'FORUM_IMG' => $user->img('forum_read', 'NO_UNREAD_POSTS'),
|
||||
'FORUM_UNREAD_IMG' => $user->img('forum_unread', 'UNREAD_POSTS'),
|
||||
|
@ -35,9 +35,9 @@
|
||||
<!-- IF LEGEND --><br /><em>{L_LEGEND}: {LEGEND}</em><!-- ENDIF --></p>
|
||||
<!-- ENDIF -->
|
||||
|
||||
<!-- IF S_DISPLAY_BIRTHDAY_LIST and BIRTHDAY_LIST -->
|
||||
<!-- IF S_DISPLAY_BIRTHDAY_LIST and .birthdays -->
|
||||
<h3>{L_BIRTHDAYS}</h3>
|
||||
<p><!-- IF BIRTHDAY_LIST -->{L_CONGRATULATIONS}: <strong>{BIRTHDAY_LIST}</strong><!-- ELSE -->{L_NO_BIRTHDAYS}<!-- ENDIF --></p>
|
||||
<p><!-- IF .birthdays -->{L_CONGRATULATIONS}: <strong><!-- BEGIN birthdays -->{birthdays.USERNAME}<!-- IF birthdays.AGE !== '' --> ({birthdays.AGE})<!-- ENDIF --><!-- IF not birthdays.S_LAST_ROW -->, <!-- ENDIF --><!-- END birthdays --></strong><!-- ELSE -->{L_NO_BIRTHDAYS}<!-- ENDIF --></p>
|
||||
<!-- ENDIF -->
|
||||
|
||||
<!-- IF NEWEST_USER -->
|
||||
|
@ -50,7 +50,7 @@
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="row1" align="center" valign="middle"><img src="{T_THEME_PATH}/images/whosonline.gif" alt="{L_BIRTHDAYS}" /></td>
|
||||
<td class="row1" width="100%"><p class="genmed"><!-- IF BIRTHDAY_LIST -->{L_CONGRATULATIONS}: <b>{BIRTHDAY_LIST}</b><!-- ELSE -->{L_NO_BIRTHDAYS}<!-- ENDIF --></p></td>
|
||||
<td class="row1" width="100%"><p class="genmed"><!-- IF .birthdays -->{L_CONGRATULATIONS}: <b><!-- BEGIN birthdays -->{birthdays.USERNAME}<!-- IF birthdays.AGE !== '' --> ({birthdays.AGE})<!-- ENDIF --><!-- IF not birthdays.S_LAST_ROW -->, <!-- ENDIF --><!-- END birthdays --></b><!-- ELSE -->{L_NO_BIRTHDAYS}<!-- ENDIF --></p></td>
|
||||
</tr>
|
||||
</table>
|
||||
<!-- ENDIF -->
|
||||
|
Loading…
x
Reference in New Issue
Block a user