user_mail_tokens
- Versions
- 6
user_mail_tokens($account,$language)- 7
user_mail_tokens(&$replacements, $data, $options)
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', and 'mail'.
$language Language object to generate the tokens with.
Return value
Array of mappings from token names to values (for use with strtr()).
Code
modules/user/user.module, line 2100
<?php
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;
}
?>Login or register to post comments 