function user_delete
Same name in other branches
- 7.x modules/user/user.module \user_delete()
Delete a user.
Drupal::entityTypeManager->getStorage('user')
->load($uid)
->delete();
Parameters
int $uid: A user ID.
Deprecated
in drupal:8.8.0 and is removed from drupal:9.0.0. Use the user entity's delete method to delete the user.
See also
https://www.drupal.org/node/3051463
1 call to user_delete()
- UserLegacyTest::testUserDelete in core/
modules/ user/ tests/ src/ Kernel/ UserLegacyTest.php - Tests that user_delete throws a deprecation error.
File
-
core/
modules/ user/ user.module, line 908
Code
function user_delete($uid) {
@trigger_error("user_delete() is deprecated in drupal:8.8.0. Use the user entity's delete method to delete the user. See https://www.drupal.org/node/3051463", E_USER_DEPRECATED);
user_delete_multiple([
$uid,
]);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.