1 user.admin.inc user_multiple_cancel_confirm_submit($form, &$form_state)

Submit handler for mass-account cancellation form.

See also

user_multiple_cancel_confirm()

user_cancel_confirm_form_submit()

File

core/modules/user/user.admin.inc, line 90
Admin page callbacks for the User module.

Code

function user_multiple_cancel_confirm_submit($form, &$form_state) {
  global $user;

  foreach ($form_state['accounts'] as $uid => $account) {
    // Prevent programmatic form submissions from cancelling user 1.
    if ($uid <= 1) {
      continue;
    }
    // Prevent user administrators from deleting themselves without confirmation.
    if ($uid == $user->uid) {
      $admin_form_state = $form_state;
      unset($admin_form_state['values']['user_cancel_confirm']);
      // The $user global is not a complete user entity, so load the full
      // entity.
      $admin_form_state['values']['_account'] = user_load($user->uid);
      user_cancel_confirm_form_submit(array(), $admin_form_state);
    }
    else {
      user_cancel($form_state['values'], $uid, $form_state['values']['user_cancel_method']);
    }
  }

  $form_state['redirect'] = 'admin/people';
}