You are here

function antispam_moderation_form_validate in AntiSpam 6

Same name and namespace in other branches
  1. 7 antispam.admin.inc \antispam_moderation_form_validate()

Form API callback; Validate the moderation queue form.

File

./antispam.admin.inc, line 839

Code

function antispam_moderation_form_validate($form, &$form_state) {
  $mode = $form_state['values']['mode'];
  $submode = $form_state['values']['submode'];
  $operation = $form_state['values']['operation'];
  $valid_operations = antispam_moderator_operations($mode, $submode);
  if (!isset($valid_operations[$operation])) {
    form_set_error('', t('Please, choose a valid operation.'));
  }
  $form_state['values']['items'] = array_diff($form_state['values']['items'], array(
    0,
  ));
  if (count($form_state['values']['items']) == 0) {
    if ($operation == 'delete') {
      form_set_error('', t('Please, select some items to perform the delete operation.'));
    }
    else {
      form_set_error('', t('Please, select some items to perform the action on.'));
    }
  }
}