Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I think it would be nice if some token support was added to this modules for things such age. I've managed to do it adding the following but it may be something to consider adding.
/**
* Implementation of hook_token_values(). (token.module)
*/
function birthdays_token_values($type, $object = NULL) {
$values = array();
switch ($type) {
case 'user':
if (isset($object)) {
$account = $object;
}
else {
global $user;
$account = user_load(array('uid' => $user->uid));
}
$values['birthday_age'] = $account->age;
break;
}
return $values;
}
/**
* Implementation of hook_token_list(). (token.module)
*/
function birthdays_token_list($type = 'all') {
if ($type == 'user' || $type == 'all') {
$tokens['user']['birthday_age'] = t("User's age");
return $tokens;
}
}
Comments
Comment #1
Niklas Fiekas CreditAttribution: Niklas Fiekas commentedThe D7 version has token support. I'd accept a patch for D6.