function user_mail_tokens in Drupal 6
Same name and namespace in other branches
- 8 core/modules/user/user.module \user_mail_tokens()
- 7 modules/user/user.module \user_mail_tokens()
- 9 core/modules/user/user.module \user_mail_tokens()
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 modules/
user/ user.module - Implementation of hook_mail().
File
- modules/
user/ user.module, line 2173 - 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;
}