You are here

function og_add_users_og_names_validate in Organic groups 6

1 string reference to 'og_add_users_og_names_validate'
og_add_users in ./og.module

File

./og.module, line 1176

Code

function og_add_users_og_names_validate($form, $form_state) {
  $names = explode(',', $form_state['values']['og_names']);
  foreach ($names as $name) {
    $account = user_load(array(
      'name' => trim($name),
    ));
    if (isset($account->uid)) {
      $accounts[] = $account;
      $uids[] = $account->uid;
    }
    else {
      $bad[] = check_plain($name);
      $err = TRUE;
    }
  }
  if (isset($err)) {
    form_set_error('og_names', format_plural(count($bad), 'Unrecognized name: %bad.', 'Unrecognized names: %bad.', array(
      '%bad' => implode(', ', $bad),
    )));
  }
}