Patch (to be ported)
Project:
Birthdays
Version:
6.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
13 Oct 2009 at 20:46 UTC
Updated:
25 Sep 2011 at 20:08 UTC
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 commentedThe D7 version has token support. I'd accept a patch for D6.