user_register_form
- Versions
- 7
user_register_form($form, &$form_state)
Form builder; the user registration form.
See also
@see user_account_form_validate()
See also
user_account_form_submit()
@see user_register_submit()
Related topics
Code
modules/user/user.module, line 3093
<?php
function user_register_form($form, &$form_state) {
global $user;
$admin = user_access('administer users');
// If we aren't admin but already logged on, go to the user page instead.
if (!$admin && $user->uid) {
drupal_goto('user/' . $user->uid);
}
$form['#user'] = drupal_anonymous_user();
$form['#user_category'] = 'register';
$form['#attached']['library'][] = array('system', 'cookie');
$form['#attributes']['class'][] = 'user-info-from-cookie';
// Start with the default user account fields.
user_account_form($form, $form_state);
if ($admin) {
// Redirect back to page which initiated the create request;
// usually admin/people/create.
$form_state['redirect'] = $_GET['q'];
}
// If the "account" fieldset is the only element at the top level, its
// borders are hidden for aesthetic reasons. We do not remove the fieldset but
// preserve the form structure so that modules implementing
// hook_form_FORM_ID_alter() know where to find the basic elements.
if (count(element_children($form)) == 1) {
$form['account']['#type'] = 'markup';
}
$form['submit'] = array(
'#type' => 'submit',
'#value' => t('Create new account'),
'#weight' => 30,
);
// Add the final user registration form submit handler.
$form['#submit'][] = 'user_register_submit';
return $form;
}
?>Login or register to post comments 