Project:Birthdays
Version:6.x-1.x-dev
Component:Code
Category:feature request
Priority:normal
Assigned:Unassigned
Status:patch (to be ported)

Issue Summary

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

#1

Version:6.x-1.0-rc1» 6.x-1.x-dev
Status:active» patch (to be ported)

The D7 version has token support. I'd accept a patch for D6.

nobody click here