You are here

function advuser_multiple_delete_confirm_submit in Advanced User 5

Same name and namespace in other branches
  1. 5.2 advuser.module \advuser_multiple_delete_confirm_submit()
  2. 6.3 forms/advuser_multiple_delete_confirm.inc \advuser_multiple_delete_confirm_submit()
  3. 6.2 advuser.module \advuser_multiple_delete_confirm_submit()
  4. 7.3 forms/advuser_multiple_delete_confirm.inc \advuser_multiple_delete_confirm_submit()

File

./advuser.module, line 369

Code

function advuser_multiple_delete_confirm_submit($form_id, $edit) {
  if ($edit['confirm']) {
    foreach ($edit['users'] as $uid => $value) {
      $account = user_load(array(
        'uid' => $uid,
      ));
      db_query('DELETE FROM {users} WHERE uid = %d', $account->uid);
      db_query('DELETE FROM {sessions} WHERE uid = %d', $account->uid);
      db_query('DELETE FROM {users_roles} WHERE uid = %d', $account->uid);
      db_query('DELETE FROM {authmap} WHERE uid = %d', $account->uid);
      watchdog('user', t('Deleted user: %name %email.', array(
        '%name' => theme('placeholder', $account->name),
        '%email' => theme('placeholder', '<' . $account->mail . '>'),
      )), WATCHDOG_NOTICE);
      drupal_set_message(t('The account has been deleted.'));
      module_invoke_all('user', 'delete', $edit, $account);
    }
    drupal_set_message(t('The items have been deleted.'));
  }
  drupal_goto('admin/user/advuser');
}