function user_mail_tokens

7.x user.module user_mail_tokens(&$replacements, $data, $options)
6.x user.module user_mail_tokens($account, $language)

Return an array of token to value mappings for user e-mail messages.

Parameters

$account: The user object of the account being notified. Must contain at least the fields 'uid', 'name', 'pass', 'login', and 'mail'.

$language: Language object to generate the tokens with.

Return value

Array of mappings from token names to values (for use with strtr()).

1 call to user_mail_tokens()
user_mail in drupal-6.x/modules/user/user.module
Implementation of hook_mail().

File

drupal-6.x/modules/user/user.module, line 2144
Enables the user registration and login system.

Code

function user_mail_tokens($account, $language) {
  global $base_url;
  $tokens = array(
    '!username' => $account->name,
    '!site' => variable_get('site_name', 'Drupal'),
    '!login_url' => user_pass_reset_url($account),
    '!uri' => $base_url,
    '!uri_brief' => preg_replace('!^https?://!', '', $base_url),
    '!mailto' => $account->mail,
    '!date' => format_date(time(), 'medium', '', NULL, $language->language),
    '!login_uri' => url('user', array('absolute' => TRUE, 'language' => $language)),
    '!edit_uri' => url('user/' . $account->uid . '/edit', array('absolute' => TRUE, 'language' => $language)),
  );
  if (!empty($account->password)) {
    $tokens['!password'] = $account->password;
  }
  return $tokens;
}