You are here

function og_add_users_validate in Organic groups 5

Same name and namespace in other branches
  1. 5.8 og.module \og_add_users_validate()
  2. 5.2 og.module \og_add_users_validate()
  3. 5.3 og.module \og_add_users_validate()
  4. 5.7 og.module \og_add_users_validate()
  5. 6.2 og.pages.inc \og_add_users_validate()

File

./og.module, line 902

Code

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