Anniversary List - Benutzerfarbe und Profillink
Verfasst: 04.12.2013 09:25
Ich nutze diese Mod https://www.phpbb.com/community/viewtopic.php?t=1677295
Code zum EInfügen in der index.php
Kann mir jemand mit dem Code helfen, ich würde gerne die Userfarbe anzeigen lassen und das der Username auf das Profil des Users verlinkt.
Ich dachte, dies wäre sogar beim ersten Jahrestag der Fall gewesen, jetzt erscheinen alle User grau. Ich kann mich aber auch täuschen.
Grüße
Theo
Code zum EInfügen in der index.php
Code: Alles auswählen
// Generate anniversary list
$anniversary_list = $cache->get('anniversary_list');
if ($anniversary_list === false)
{
$anniversary_list = '';
$current_date = date('m-d');
$current_year = date('Y');
$leap_year = date('L');
$sql = 'SELECT user_id, username, user_colour, user_regdate
FROM ' . USERS_TABLE . "
WHERE user_type IN (" . USER_NORMAL . ', ' . USER_FOUNDER . ')';
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result))
{
// We are compensating for leap year here. If the year is not a leap year, the current date is Feb 28, and they joined Feb 29 we will list their names.
if (date('m-d', $row['user_regdate']) == $current_date || (!$leap_year && $current_date == '02-28' && date('m-d', $row['user_regdate']) == '02-29'))
{
if (($current_year - date('Y', $row['user_regdate'])) > 0)
{
$anniversary_list .= (($anniversary_list != '') ? ', ' : '') . get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']);
$anniversary_list .= ' (' . ($current_year - date('Y', $row['user_regdate'])) . ')';
}
}
}
$db->sql_freeresult($result);
//Figure out what tomorrow's beginning time is based on the board timezone settings and have the cache expire then.
$till_tomorrow = gmmktime(0, 0, 0) + 86400 - ($config['board_timezone'] * 3600) - ($config['board_dst'] * 3600) - time();
$cache->put('anniversary_list', $anniversary_list, $till_tomorrow);
}
$template->assign_var('ANNIVERSARY_LIST', $anniversary_list);
Ich dachte, dies wäre sogar beim ersten Jahrestag der Fall gewesen, jetzt erscheinen alle User grau. Ich kann mich aber auch täuschen.
Grüße
Theo