function user_delete

7.x user.module user_delete($uid)
6.x user.module user_delete($edit, $uid)

Delete a user.

Parameters

$edit An array of submitted form values.:

$uid The user ID of the user to delete.:

2 calls to user_delete()
user_confirm_delete_submit in drupal-6.x/modules/user/user.pages.inc
Submit function for the confirm form for user deletion.
user_multiple_delete_confirm_submit in drupal-6.x/modules/user/user.module

File

drupal-6.x/modules/user/user.module, line 1660
Enables the user registration and login system.

Code

function user_delete($edit, $uid) {
  $account = user_load(array('uid' => $uid));
  sess_destroy_uid($uid);
  _user_mail_notify('status_deleted', $account);
  db_query('DELETE FROM {users} WHERE uid = %d', $uid);
  db_query('DELETE FROM {users_roles} WHERE uid = %d', $uid);
  db_query('DELETE FROM {authmap} WHERE uid = %d', $uid);
  $variables = array('%name' => $account->name, '%email' => '<' . $account->mail . '>');
  watchdog('user', 'Deleted user: %name %email.', $variables, WATCHDOG_NOTICE);
  user_module_invoke('delete', $edit, $account);
}