You are here

function realname_registration_form_alter in Realname registration 7.2

Same name and namespace in other branches
  1. 6.2 realname_registration.module \realname_registration_form_alter()
  2. 6 realname_registration.module \realname_registration_form_alter()
  3. 7 realname_registration.module \realname_registration_form_alter()

Implementation of hook_form_alter().

File

./realname_registration.module, line 64
For using real names during registration/

Code

function realname_registration_form_alter(&$form, $form_state, $form_id) {
  if (!($form_id == 'user_register_form')) {
    return;
  }
  if (isset($form['account']) && is_array($form['account'])) {
    $form['account']['name']['#type'] = 'hidden';
    $form['account']['name']['#value'] = 'unset_username';
  }
  else {
    $form['name']['#type'] = 'hidden';
    $form['name']['#value'] = 'unset_username';
  }
  $form['#validate'][] = 'realname_registration_mandatory_validate';
  if (variable_get('realname_registration_use_validation')) {
    $form['#validate'][] = 'realname_registration_validate';
  }
}