function realname_registration_form_alter in Realname registration 6
Same name and namespace in other branches
- 6.2 realname_registration.module \realname_registration_form_alter()
- 7.2 realname_registration.module \realname_registration_form_alter()
- 7 realname_registration.module \realname_registration_form_alter()
Implementation of hook_form_alter().
File
- ./
realname_registration.module, line 14 - For using real names during registration/
Code
function realname_registration_form_alter(&$form, $form_state, $form_id) {
if (!($form_id == 'user_register')) {
return;
}
if (isset($form['account']) && is_array($form['account'])) {
$form['account']['name']['#type'] = 'hidden';
$form['account']['name']['#value'] = 'unset_username';
$form['account']['firstname'] = array(
'#description' => t('Please enter your first name, this field must only contain letters.'),
'#maxlength' => 60,
'#type' => 'textfield',
'#title' => t('First name'),
'#weight' => -500,
'#required' => TRUE,
);
$form['account']['lastname'] = array(
'#description' => t('Please enter your last name, this field must only contain letters.'),
'#maxlength' => 60,
'#type' => 'textfield',
'#title' => t('Last name'),
'#weight' => -499,
'#required' => TRUE,
);
}
else {
$form['name']['#type'] = 'hidden';
$form['name']['#value'] = 'unset_username';
$form['firstname'] = array(
'#description' => t('Please enter your first name, this field must only contain letters.'),
'#maxlength' => 60,
'#type' => 'textfield',
'#title' => t('First name'),
'#weight' => -500,
'#required' => TRUE,
);
$form['lastname'] = array(
'#description' => t('Please enter your last name, this field must only contain letters.'),
'#maxlength' => 60,
'#type' => 'textfield',
'#title' => t('Last name'),
'#weight' => -499,
'#required' => TRUE,
);
}
$form['#validate'][] = 'realname_registration_validate';
}