You are here

function og_massadd_massadd_form_validate in Organic Groups Mass Add 6

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

Mass adding users validation

File

./og_massadd.module, line 107
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!"));
  }
  else {
    if (trim($form_state['values']['massadd']) && !_og_massadd_textareavalidate($form_state['values']['massadd'])) {
      form_set_error('massadd', t("Unknown format of userlist!"));
    }
  }
}