You are here

function user_delete in Drupal 6

Same name and namespace in other branches
  1. 8 core/modules/user/user.module \user_delete()
  2. 5 modules/user/user.module \user_delete()
  3. 7 modules/user/user.module \user_delete()

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 modules/user/user.pages.inc
Submit function for the confirm form for user deletion.
user_multiple_delete_confirm_submit in modules/user/user.module

File

modules/user/user.module, line 1689
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);
}