function user_cancel_url

Generates a URL to confirm an account cancellation request.

Parameters

object $account: The user account object, which must contain at least the following properties:

  • uid: The user ID number.
  • pass: The hashed user password string.
  • login: The UNIX timestamp of the user's last login.

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 value

A unique URL that may be used to confirm the cancellation of the user account.

See also

user_mail_tokens()

user_cancel_confirm()

2 calls to user_cancel_url()
UserTokenReplaceTest::testUserTokenReplacement in drupal/core/modules/user/lib/Drupal/user/Tests/UserTokenReplaceTest.php
Creates a user, then tests the tokens generated from it.
user_mail_tokens in drupal/core/modules/user/user.module
Token callback to add unsafe tokens for user mails.

File

drupal/core/modules/user/user.module, line 1461
Enables the user registration and login system.

Code

function user_cancel_url($account, $options = array()) {
  $timestamp = REQUEST_TIME;
  $langcode = isset($options['langcode']) ? $options['langcode'] : user_preferred_langcode($account);
  $url_options = array(
    'absolute' => TRUE,
    'language' => language_load($langcode),
  );
  return url("user/{$account->uid}/cancel/confirm/{$timestamp}/" . user_pass_rehash($account->pass, $timestamp, $account->login), $url_options);
}