You are here

function user_delete_multiple_confirm_submit in User Delete 6.2

Submit handler for mass-account cancellation form.

See also

user_multiple_cancel_confirm()

user_cancel_confirm_form_submit()

1 string reference to 'user_delete_multiple_confirm_submit'
user_delete_form_alter in ./user_delete.module
Implementation of hook_form_alter().

File

./user_delete.module, line 240
Provide account cancellation methods and API to provide the same functionalty as Drupal 7 for cancelling accounts.

Code

function user_delete_multiple_confirm_submit($form, &$form_state) {
  global $user;
  if ($form_state['values']['confirm']) {
    foreach ($form_state['values']['accounts'] as $uid => $value) {

      // 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']);
        $admin_form_state['values']['_account'] = $user;
        user_delete_confirm_form_submit(array(), $admin_form_state);
      }
      else {
        user_delete_cancel($form_state['values'], $uid, $form_state['values']['user_cancel_method']);
      }
    }
  }
  $form_state['redirect'] = 'admin/user/user';
}