You are here

function purge_users_multiple_cancel_confirm in Auto Purge Users 7.2

Same name and namespace in other branches
  1. 7 purge_users.module \purge_users_multiple_cancel_confirm()

Mass cancel user account confirmation form.

1 call to purge_users_multiple_cancel_confirm()
purge_users_config_form in ./purge_users.pages.inc
Menu callback function.

File

./purge_users.module, line 325
Purge users module file.

Code

function purge_users_multiple_cancel_confirm($form, &$form_state, $uids, $cancel_method) {
  $form['accounts'] = array(
    '#prefix' => '<ul>',
    '#suffix' => '</ul>',
    '#tree' => TRUE,
  );
  $accounts = user_load_multiple($uids);
  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) . " &lt;" . $account->mail . "&gt; </li>\n",
    );
  }
  $form['purge_users_cancel_method'] = array(
    '#type' => 'hidden',
    '#value' => $cancel_method,
  );
  $form['#submit'][] = 'purge_users_multiple_cancel_confirm_submit';
  return confirm_form($form, t('Are you sure you want to cancel these user accounts?'), 'admin/people/purge-rule', t('This action cannot be undone.'), t('Cancel accounts'), t('Cancel'));
}