You are here

function password_policy_mail_tokens in Password Policy 7

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

Token callback to add Password Policy tokens for user e-mails.

This function is used by the token_replace() call at the end of _password_policy_mail_text() to set up some additional tokens that can be used in email messages generated by password_policy_mail().

Parameters

array $replacements: An associative array variable containing mappings from token names to values (for use with strtr()).

array $data: An associative array of token replacement values.

array $options: Unused parameter required by the token_replace() function.

1 string reference to 'password_policy_mail_tokens'
_password_policy_mail_text in ./password_policy.module
Returns a mail string for a variable name.

File

./password_policy.module, line 1226
Allows enforcing restrictions on user passwords by defining policies.

Code

function password_policy_mail_tokens(array &$replacements, array $data, array $options) {
  if (isset($data['days_left'])) {
    $replacements['[password-policy:days-left]'] = $data['days_left'];
  }
  $password_edit_url_token = '[password-policy:password-edit-url]';
  $account = $data['user'];
  $password_edit_url = _password_policy_get_preferred_password_edit_url_for_user($account);
  $replacements[$password_edit_url_token] = $password_edit_url;
}