aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Fischer <bantu@phpbb.com>2011-05-08 15:24:03 +0200
committerAndreas Fischer <bantu@phpbb.com>2011-05-08 15:36:27 +0200
commit2f458352b8660386021af6868dcec75943bb8483 (patch)
treea13c6639b7c6c4319308c39e6e8eb7b2c3d5f5ee
parent6a3f34ae61287e8390ed22fa118c134f7102346b (diff)
downloadforums-2f458352b8660386021af6868dcec75943bb8483.tar
forums-2f458352b8660386021af6868dcec75943bb8483.tar.gz
forums-2f458352b8660386021af6868dcec75943bb8483.tar.bz2
forums-2f458352b8660386021af6868dcec75943bb8483.tar.xz
forums-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
-rw-r--r--phpBB/index.php14
-rw-r--r--phpBB/styles/prosilver/template/index_body.html4
-rw-r--r--phpBB/styles/subsilver2/template/index_body.html2
3 files changed, 14 insertions, 6 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);
}
diff --git a/phpBB/styles/prosilver/template/index_body.html b/phpBB/styles/prosilver/template/index_body.html
index 539c851d1d..b183cf4372 100644
--- a/phpBB/styles/prosilver/template/index_body.html
+++ b/phpBB/styles/prosilver/template/index_body.html
@@ -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 -->
diff --git a/phpBB/styles/subsilver2/template/index_body.html b/phpBB/styles/subsilver2/template/index_body.html
index e52e357564..100199c209 100644
--- a/phpBB/styles/subsilver2/template/index_body.html
+++ b/phpBB/styles/subsilver2/template/index_body.html
@@ -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 -->