function theme_birthdays_block in Birthdays 5
Theme function of the blocks
@returns themed content
1 theme call to theme_birthdays_block()
- birthdays_block in ./
birthdays.module - Implementation of hook_block
File
- ./
birthdays.module, line 765 - The Birthdays module allows users to add their birthday to their profile. It lists birthdays on a seperate page and in different blocks. Users can receive an e-mail on their birthday automatically, and the administrator can receive daily reminders of…
Code
function theme_birthdays_block($birthdays, $amount, $delta) {
global $_birthdays_field;
if (!empty($birthdays)) {
$output = '<table>';
foreach ($birthdays as $b) {
$account = user_load(array(
'uid' => $b,
));
$age = _birthdays_show_age($account);
// +1 when the birthday isn't today, because it shows the age the person will be on his/her birthday
$age = isset($age) ? '(' . ($account->age + !($account->{$_birthdays_field->name}['day'] == format_date(time(), 'custom', 'j') && $account->{$_birthdays_field->name}['month'] == format_date(time(), 'custom', 'n'))) . ')' : '';
$account->{$_birthdays_field->name}['year'] = NULL;
// Don't show the year in blocks
$output .= '<tr><td>' . theme('username', $account) . ' <small>' . $age . '</small></td><td>' . _birthdays_show_date($account->{$_birthdays_field->name}, $account) . '</td></tr>';
}
$output .= '</table>';
}
else {
$output = '<p>' . t('Nobody is having their birthday soon.') . '</p>';
}
$output .= '<div class="more-link">' . l(t('more'), 'birthdays', array(
'title' => t('Show all birthdays.'),
)) . '</div>';
return $output;
}