function user_mail_edit_tokens_value in Mail Editor 6
Implementation of hook_mail_edit_tokens_value().
1 call to user_mail_edit_tokens_value()
- logintoboggan_mail_edit_tokens_value in ./
mail_edit_logintoboggan.inc - Implementation of hook_mail_edit_tokens_values().
File
- ./
mail_edit_user.inc, line 57 - A sample implementation of Mail Editor hooks for User core module.
Code
function user_mail_edit_tokens_value($mailkey, $mail, $options = array()) {
global $base_url;
$account = $mail['params']['account'];
$language = $mail['language'];
$tokens = array(
'!username_themed' => strip_tags(theme('username', $account, array(
'plain' => TRUE,
))),
'!username' => $account->name,
'!site' => variable_get('site_name', 'Drupal'),
'!login_url' => user_pass_reset_url($account),
'!uri_brief' => drupal_substr($base_url, drupal_strlen('http://')),
'!uri' => $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;
}