You are here

function _password_policy_mail_text in Password Policy 6

Same name and namespace in other branches
  1. 5 password_policy.module \_password_policy_mail_text()
  2. 7 password_policy.module \_password_policy_mail_text()

Returns a mail string for a variable name.

Used by password_policy_mail() and the settings forms to retrieve strings.

2 calls to _password_policy_mail_text()
password_policy_admin_settings in ./password_policy.admin.inc
Settings form display.
password_policy_mail in ./password_policy.module
Implements hook_mail().

File

./password_policy.module, line 722
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_text($key, $language = NULL, $variables = array()) {
  $langcode = isset($language) ? $language->language : NULL;
  if ($admin_setting = variable_get('password_policy_' . $key, FALSE)) {

    // An admin setting overrides the default string.
    return strtr($admin_setting, $variables);
  }
  else {

    // No override, return with default strings.
    switch ($key) {
      case 'warning_subject':
        return t('Password expiration warning for !username at !site', $variables, $langcode);
      case 'warning_body':
        return t("!username,\n\nYour password at !site will expire in less than !days_left day(s).\n\nPlease go to !edit_uri to change your password.", $variables, $langcode);
    }
  }
}