You are here

function antispam_moderation_form_validate in AntiSpam 7

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

Form API callback; Validate the moderation queue form.

File

./antispam.admin.inc, line 873
The antispam admin theme.

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.'));
    }
  }
}