function user_delete_multiple

Same name in other branches
  1. 7.x 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

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);
}

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