function user_multiple_cancel_confirm_submit

Submit handler for mass-account cancellation form.

See also

user_multiple_cancel_confirm()

user_cancel_confirm_form_submit()

File

modules/user/user.module, line 3452

Code

function user_multiple_cancel_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_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';
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.