You are here

function _password_policy_expire_notify in Password Policy 7.2

Notifies user of upcoming password expiration by e-mail.

Parameters

object $account: User object.

object $candidate: Various expiration-related information pertaining to user.

int $expire: Time when password will expire, in seconds since Unix epoch.

PasswordPolicyExpire $item: Expiration policy item.

1 call to _password_policy_expire_notify()
PasswordPolicyExpire::cron in plugins/item/expire.inc
Cron task for expiration plugin.

File

plugins/item/expire.inc, line 122

Code

function _password_policy_expire_notify($account, $candidate, $expire, PasswordPolicyExpire $item) {
  $body = token_replace($item->config['expire_warning_email_message'], array(
    'user' => $account,
    'password_expiration_date' => $expire,
  ));
  $subject = token_replace($item->config['expire_warning_email_subject'], array(
    'user' => $account,
    'password_expiration_date' => $expire,
  ));
  $message = drupal_mail('password_policy', 'warning', $account->mail, user_preferred_language($account), array(
    'body' => $body,
    'subject' => $subject,
  ));
  return $message;
}