function user_multiple_cancel_confirm

1 string reference to 'user_multiple_cancel_confirm'
user_admin in drupal/core/modules/user/user.admin.inc
@file Admin page callback file for the user module.

File

drupal/core/modules/user/user.module, line 2447
Enables the user registration and login system.

Code

function user_multiple_cancel_confirm($form, &$form_state) {
  $edit = $form_state['input'];
  $form['accounts'] = array(
    '#prefix' => '<ul>',
    '#suffix' => '</ul>',
    '#tree' => TRUE,
  );
  $accounts = user_load_multiple(array_keys(array_filter($edit['accounts'])));
  foreach ($accounts as $uid => $account) {

    // Prevent user 1 from being canceled.
    if ($uid <= 1) {
      continue;
    }
    $form['accounts'][$uid] = array(
      '#type' => 'hidden',
      '#value' => $uid,
      '#prefix' => '<li>',
      '#suffix' => check_plain($account->name) . "</li>\n",
    );
  }

  // Output a notice that user 1 cannot be canceled.
  if (isset($accounts[1])) {
    $redirect = count($accounts) == 1;
    $message = t('The user account %name cannot be cancelled.', array(
      '%name' => $accounts[1]->name,
    ));
    drupal_set_message($message, $redirect ? 'error' : 'warning');

    // If only user 1 was selected, redirect to the overview.
    if ($redirect) {
      drupal_goto('admin/people');
    }
  }
  $form['operation'] = array(
    '#type' => 'hidden',
    '#value' => 'cancel',
  );
  form_load_include($form_state, 'inc', 'user', 'user.pages');
  $form['user_cancel_method'] = array(
    '#type' => 'radios',
    '#title' => t('When cancelling these accounts'),
  );
  $form['user_cancel_method'] += user_cancel_methods();

  // Allow to send the account cancellation confirmation mail.
  $form['user_cancel_confirm'] = array(
    '#type' => 'checkbox',
    '#title' => t('Require e-mail confirmation to cancel account.'),
    '#default_value' => FALSE,
    '#description' => t('When enabled, the user must confirm the account cancellation via e-mail.'),
  );

  // Also allow to send account canceled notification mail, if enabled.
  $form['user_cancel_notify'] = array(
    '#type' => 'checkbox',
    '#title' => t('Notify user when account is canceled.'),
    '#default_value' => FALSE,
    '#access' => config('user.settings')
      ->get('notify.status_canceled'),
    '#description' => t('When enabled, the user will receive an e-mail notification after the account has been cancelled.'),
  );
  return confirm_form($form, t('Are you sure you want to cancel these user accounts?'), 'admin/people', t('This action cannot be undone.'), t('Cancel accounts'), t('Cancel'));
}