You are here

function password_policy_mail_tokens in Password Policy 6

Same name and namespace in other branches
  1. 7 password_policy.module \password_policy_mail_tokens()

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

Parameters

$params: Structured array with the parameters.

$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 password_policy_mail_tokens()
password_policy_mail in ./password_policy.module
Implements hook_mail().

File

./password_policy.module, line 751
The password policy module allows you to enforce a specific level of password complexity for the user passwords on the system.

Code

function password_policy_mail_tokens($params, $language) {
  global $base_url;
  $account = $params['account'];
  $tokens = array(
    '!username' => $account->name,
    '!mailto' => $account->mail,
    '!site' => variable_get('site_name', 'Drupal'),
    '!uri' => $base_url,
    '!uri_brief' => drupal_substr($base_url, drupal_strlen('http://')),
    '!date' => format_date(time(), 'medium', '', NULL, $language->language),
    '!login_uri' => url('user', array(
      'absolute' => TRUE,
    )),
    '!edit_uri' => url('user/' . $account->uid . '/edit' . (module_exists('password_policy_password_tab') ? '/password' : ''), array(
      'absolute' => TRUE,
    )),
    '!days_left' => isset($params['days_left']) ? $params['days_left'] : NULL,
    '!login_url' => isset($params['login_url']) ? $params['login_url'] : NULL,
  );
  return $tokens;
}