You are here

function email_verify_user_check_form_submit in Email Verify 8.2

Same name and namespace in other branches
  1. 7.2 email_verify.check.inc \email_verify_user_check_form_submit()

Submit handler for the user check form.

File

./email_verify.check.inc, line 148
User email check menu callback file for email_verify module.

Code

function email_verify_user_check_form_submit($form, &$form_state) {

  // Clear any saved data.
  variable_del('email_verify_users_to_display');
  $disabled_users = FALSE;
  if (isset($form_state['values']['disabled']) && $form_state['values']['disabled'] == 1) {
    $disabled_users = TRUE;
  }

  // Prepare the operations.
  $user_count = 0;
  if (!empty($form_state['values']['number'])) {
    $user_count = trim($form_state['values']['number']);
  }
  $user_offset = 0;
  $current_uid = 0;
  if (!empty($form_state['values']['offset'])) {
    $user_offset = trim($form_state['values']['offset']);
    if (!empty($user_offset)) {

      // Get the user ID of the user to start the verification process with.
      $current_uid = _email_verify_batch_display_get_current_uid($user_offset, $disabled_users);
    }
  }

  // Get the number of users to verify.
  $max = _email_verify_batch_display_get_max($user_count, $user_offset, $disabled_users, $current_uid);
  $operations = array();
  $operations[] = array(
    '_email_verify_batch_display_process_batch',
    array(
      $current_uid,
      $max,
      $disabled_users,
    ),
  );

  // Prepare the batch.
  $batch = array(
    'title' => t('Checking the email addresses of @user_count users. You may want to go get a cup of coffee now. Or maybe a sandwich.', array(
      '@user_count' => $user_count,
    )),
    'operations' => $operations,
    'progress_message' => t('Completed @current of @total operations.'),
    'error_message' => t('One or more errors were encountered processing the users.'),
    'finished' => '_email_verify_batch_finish_batch',
    'file' => drupal_get_path('module', 'email_verify') . '/email_verify.check.inc',
  );

  // Set the batch.
  batch_set($batch);
}