function _user_cancel

Same name and namespace in other branches
  1. 10 core/modules/user/user.module \_user_cancel()
  2. 9 core/modules/user/user.module \_user_cancel()
  3. 8.9.x core/modules/user/user.module \_user_cancel()
  4. 7.x modules/user/user.module \_user_cancel()
  5. main core/modules/user/user.module \_user_cancel()

Implements callback_batch_operation().

Last step for cancelling a user account.

Since batch and session API require a valid user account, the actual cancellation of a user account needs to happen last.

Parameters

array $edit: An array of submitted form values.

\Drupal\user\UserInterface $account: The user ID of the user account to cancel.

string $method: The account cancellation method to use.

Deprecated

in drupal:11.5.0 and is removed from drupal:13.0.0. Use \Drupal::service(AccountCancellation::class)->cancelAccount() instead.

See also

https://www.drupal.org/node/3620934

AccountCancellation::cancel()

File

core/modules/user/user.module, line 297

Code

function _user_cancel($edit, $account, $method) : void {
  @trigger_error(__FUNCTION__ . '() is deprecated in drupal:11.5.0 and is removed from drupal:13.0.0. Use \\Drupal::service(AccountCancellation::class)->cancelAccount() instead. See https://www.drupal.org/node/3620934', E_USER_DEPRECATED);
  \Drupal::service(AccountCancellation::class)->cancelAccount($edit, $account, $method);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.