You are here

function cas_add_user_form_submit in CAS 6.3

Same name and namespace in other branches
  1. 7 cas.user.inc \cas_add_user_form_submit()

File

./cas.user.inc, line 31
Provides CAS user registration administrative pages.

Code

function cas_add_user_form_submit($form, &$form_state) {
  $options = array(
    'invoke_cas_user_presave' => TRUE,
  );
  $account = cas_user_register($form_state['values']['cas_name'], $options);

  // Terminate if an error occurred while registering the user.
  if (!$account) {
    drupal_set_message(t("Error saving user account."), 'error');
    $form_state['redirect'] = '';
    return;
  }

  // Set these in case another module needs the values.
  $form_state['user'] = $account;
  $form_state['values']['uid'] = $account->uid;
  drupal_set_message(t('Created a new user account for <a href="@url">%name</a>. No e-mail has been sent.', array(
    '@url' => url("user/{$account->uid}"),
    '%name' => $account->name,
  )));
}