|
@@ -2359,14 +2359,26 @@ function user_external_login_register($name, $module) {
|
|
* following properties:
|
|
* following properties:
|
|
* - uid: The user ID number.
|
|
* - uid: The user ID number.
|
|
* - login: The UNIX timestamp of the user's last login.
|
|
* - login: The UNIX timestamp of the user's last login.
|
|
|
|
+ * @param array $options
|
|
|
|
+ * (optional) A keyed array of settings. Supported options are:
|
|
|
|
+ * - langcode: A language code to be used when generating locale-sensitive
|
|
|
|
+ * urls. If langcode is NULL the users preferred language is used.
|
|
*
|
|
*
|
|
* @return
|
|
* @return
|
|
* A unique URL that provides a one-time log in for the user, from which
|
|
* A unique URL that provides a one-time log in for the user, from which
|
|
* they can change their password.
|
|
* they can change their password.
|
|
*/
|
|
*/
|
|
-function user_pass_reset_url($account) {
|
|
|
|
|
|
+function user_pass_reset_url($account, $options = array()) {
|
|
$timestamp = REQUEST_TIME;
|
|
$timestamp = REQUEST_TIME;
|
|
- return url("user/reset/$account->uid/$timestamp/" . user_pass_rehash($account->pass, $timestamp, $account->login, $account->uid), array('absolute' => TRUE));
|
|
|
|
|
|
+ $url_options = array('absolute' => TRUE);
|
|
|
|
+ if (isset($options['langcode'])) {
|
|
|
|
+ $languages = language_list();
|
|
|
|
+ $url_options['language'] = $languages[$options['langcode']];
|
|
|
|
+ }
|
|
|
|
+ else {
|
|
|
|
+ $url_options['language'] = user_preferred_language($account);
|
|
|
|
+ }
|
|
|
|
+ return url("user/reset/$account->uid/$timestamp/" . user_pass_rehash($account->pass, $timestamp, $account->login, $account->uid), $url_options);
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -2378,6 +2390,10 @@ function user_pass_reset_url($account) {
|
|
* - uid: The user ID number.
|
|
* - uid: The user ID number.
|
|
* - pass: The hashed user password string.
|
|
* - pass: The hashed user password string.
|
|
* - login: The UNIX timestamp of the user's last login.
|
|
* - login: The UNIX timestamp of the user's last login.
|
|
|
|
+ * @param array $options
|
|
|
|
+ * (optional) A keyed array of settings. Supported options are:
|
|
|
|
+ * - langcode: A language code to be used when generating locale-sensitive
|
|
|
|
+ * urls. If langcode is NULL the users preferred language is used.
|
|
*
|
|
*
|
|
* @return
|
|
* @return
|
|
* A unique URL that may be used to confirm the cancellation of the user
|
|
* A unique URL that may be used to confirm the cancellation of the user
|
|
@@ -2386,9 +2402,17 @@ function user_pass_reset_url($account) {
|
|
* @see user_mail_tokens()
|
|
* @see user_mail_tokens()
|
|
* @see user_cancel_confirm()
|
|
* @see user_cancel_confirm()
|
|
*/
|
|
*/
|
|
-function user_cancel_url($account) {
|
|
|
|
|
|
+function user_cancel_url($account, $options = array()) {
|
|
$timestamp = REQUEST_TIME;
|
|
$timestamp = REQUEST_TIME;
|
|
- return url("user/$account->uid/cancel/confirm/$timestamp/" . user_pass_rehash($account->pass, $timestamp, $account->login, $account->uid), array('absolute' => TRUE));
|
|
|
|
|
|
+ $url_options = array('absolute' => TRUE);
|
|
|
|
+ if (isset($options['langcode'])) {
|
|
|
|
+ $languages = language_list();
|
|
|
|
+ $url_options['language'] = $languages[$options['langcode']];
|
|
|
|
+ }
|
|
|
|
+ else {
|
|
|
|
+ $url_options['language'] = user_preferred_language($account);
|
|
|
|
+ }
|
|
|
|
+ return url("user/$account->uid/cancel/confirm/$timestamp/" . user_pass_rehash($account->pass, $timestamp, $account->login, $account->uid), $url_options);
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -2878,7 +2902,7 @@ Your account on [site:name] has been canceled.
|
|
if ($replace) {
|
|
if ($replace) {
|
|
// We do not sanitize the token replacement, since the output of this
|
|
// We do not sanitize the token replacement, since the output of this
|
|
// replacement is intended for an e-mail message, not a web browser.
|
|
// replacement is intended for an e-mail message, not a web browser.
|
|
- return token_replace($text, $variables, array('language' => $language, 'callback' => 'user_mail_tokens', 'sanitize' => FALSE, 'clear' => TRUE));
|
|
|
|
|
|
+ return token_replace($text, $variables, array('language' => $language, 'langcode' => $langcode, 'callback' => 'user_mail_tokens', 'sanitize' => FALSE, 'clear' => TRUE));
|
|
}
|
|
}
|
|
|
|
|
|
return $text;
|
|
return $text;
|
|
@@ -2905,8 +2929,8 @@ Your account on [site:name] has been canceled.
|
|
*/
|
|
*/
|
|
function user_mail_tokens(&$replacements, $data, $options) {
|
|
function user_mail_tokens(&$replacements, $data, $options) {
|
|
if (isset($data['user'])) {
|
|
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']);
|
|
|
|
|
|
+ $replacements['[user:one-time-login-url]'] = user_pass_reset_url($data['user'], $options);
|
|
|
|
+ $replacements['[user:cancel-url]'] = user_cancel_url($data['user'], $options);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|