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().
$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:
$options: Unused parameter required by the token_replace() function.
function user_mail_tokens(&$replacements, $data, $options) {
if (isset($data['user'])) {
$replacements['[user:one-time-login-url]'] = user_pass_reset_url($data['user'], $options);
$replacements['[user:cancel-url]'] = user_cancel_url($data['user'], $options);
}
}