You are here

function _recovery_pass_mail_text in Recovery Password (Email New Password) 7

Returns a mail string for a variable name.

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

5 calls to _recovery_pass_mail_text()
recovery_pass_config_form in ./recovery_pass.admin.inc
Callback to admin/config/people/recovery-pass.
recovery_pass_forgot_password_submit in ./recovery_pass.module
Custom submit handler to send password in recovery mail.
recovery_pass_user_login_validate in ./recovery_pass.module
Custom Submit handler for user login form.
recovery_pass_variable_info in ./recovery_pass.variable.inc
Implements hook_variable_info().
_recovery_pass_request_new_password in ./recovery_pass.resource.inc

File

./recovery_pass.module, line 142
Alters default Drupal password recovery process by overriding default submit.

Code

function _recovery_pass_mail_text($key, $language = NULL, $replace = TRUE, $user = array()) {
  $langcode = !empty($language) ? $language->language : NULL;
  $text = '';
  if ($admin_setting = variable_get('recovery_pass_' . $key, FALSE)) {

    // An admin setting overrides the default string.
    $text = $admin_setting;
  }
  else {

    // No override, return default string.
    switch ($key) {
      case 'email_subject':
        $text = t('Replacement login information for [user:name] at [site:name]', array(), array(
          'langcode' => $langcode,
        ));
        break;
      case 'email_text':
        $text = t("[user:name],\n\nA request to reset the password for your account has been made at [site:name].\n\nYour new password is [user_new_password].\n\n\n--  [site:name] team", array(), array(
          'langcode' => $langcode,
        ));
        break;
      case 'old_pass_warning':
        $text = t('You are using <strong>old password</strong>, your password was reset recently. New Password was sent to your registered email id.');
        break;
    }
  }
  if ($replace) {

    // Token Replace the text.
    return token_replace($text, array(
      'user' => $user,
    ));
  }
  return $text;
}