You are here

function user_delete_multiple in Drupal 8

Same name and namespace in other branches
  1. 7 modules/user/user.module \user_delete_multiple()

Delete multiple user accounts.

$storage_handler = \Drupal::entityTypeManager()
  ->getStorage('user');
$users = $storage_handler
  ->loadMultiple($uids);
$storage_handler
  ->delete($users);

Parameters

int[] $uids: An array of user IDs.

Deprecated

in drupal:8.8.0 and is removed from drupal:9.0.0. Use the entity storage system to delete the users.

See also

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

2 calls to user_delete_multiple()
UserLegacyTest::testUserDeleteMultiple in core/modules/user/tests/src/Kernel/UserLegacyTest.php
Tests that user_delete_multiple throws a deprecation error.
user_delete in core/modules/user/user.module
Delete a user.

File

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

Code

function user_delete_multiple(array $uids) {
  @trigger_error("user_delete_multiple() is deprecated in drupal:8.8.0. Use the entity storage system to delete the users. See https://www.drupal.org/node/3051463", E_USER_DEPRECATED);
  entity_delete_multiple('user', $uids);
}