You are here

function og_massadd_massadd_form_validate in Organic Groups Mass Add 7

Same name and namespace in other branches
  1. 6 og_massadd.module \og_massadd_massadd_form_validate()

Mass adding users validation

File

./og_massadd.module, line 162
The og_massadd module file

Code

function og_massadd_massadd_form_validate($form, &$form_state) {
  $gotfile = isset($_FILES['files']) && $_FILES['files']['name']['massadd_csv'] && is_uploaded_file($_FILES['files']['tmp_name']['massadd_csv']);
  if (!trim($form_state['values']['massadd']) && !$gotfile) {
    form_set_error('massadd', t("No users to add!"));
  }
  elseif (trim($form_state['values']['massadd']) && !_og_massadd_textareavalidate($form_state['values']['massadd'])) {
    form_set_error('massadd', t("Unknown format of userlist!"));
  }
}