function user_mail_tokens
Same name in other branches
- 9 core/modules/user/user.module \user_mail_tokens()
- 8.9.x core/modules/user/user.module \user_mail_tokens()
- 10 core/modules/user/user.module \user_mail_tokens()
- 11.x core/modules/user/user.module \user_mail_tokens()
Token callback to add unsafe tokens for user mails.
This function is used by the token_replace() call at the end of _user_mail_text() to set up some additional tokens that can be used in email messages generated by user_mail().
Parameters
$replacements: An associative array variable containing mappings from token names to values (for use with strtr()).
$data: An associative array of token replacement values. If the 'user' element exists, it must contain a user account object with the following properties:
- login: The UNIX timestamp of the user's last login.
- pass: The hashed account login password.
$options: Unused parameter required by the token_replace() function.
1 string reference to 'user_mail_tokens'
- _user_mail_text in modules/
user/ user.module - Returns a mail string for a variable name.
File
-
modules/
user/ user.module, line 2949
Code
function user_mail_tokens(&$replacements, $data, $options) {
if (isset($data['user'])) {
$replacements['[user:one-time-login-url]'] = user_pass_reset_url($data['user']);
$replacements['[user:cancel-url]'] = user_cancel_url($data['user']);
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.