You are here

function user_delete in Drupal 5

Same name and namespace in other branches
  1. 8 core/modules/user/user.module \user_delete()
  2. 6 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.module
user_multiple_delete_confirm_submit in modules/user/user.module

File

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

Code

function user_delete($edit, $uid) {
  $account = user_load(array(
    'uid' => $uid,
  ));
  sess_destroy_uid($uid);
  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);
  $array = array(
    '%name' => $account->name,
    '%email' => '<' . $account->mail . '>',
  );
  watchdog('user', t('Deleted user: %name %email.', $array), WATCHDOG_NOTICE);
  drupal_set_message(t('%name has been deleted.', $array));
  module_invoke_all('user', 'delete', $edit, $account);
}