function user_register in Drupal 5
Same name and namespace in other branches
- 4 modules/user.module \user_register()
- 6 modules/user/user.module \user_register()
6 string references to 'user_register'
- theme_comment_post_forbidden in modules/comment/comment.module
- user_admin in modules/user/user.module
- user_admin_settings in modules/user/user.module
- user_login_block in modules/user/user.module
- user_menu in modules/user/user.module
- Implementation of hook_menu().
... See full list
File
- modules/user/user.module, line 1187
- Enables the user registration and login system.
Code
function user_register() {
global $user;
$admin = user_access('administer users');
if (!$admin && $user->uid) {
drupal_goto('user/' . $user->uid);
}
$form = array();
if (!$admin) {
$form['user_registration_help'] = array(
'#value' => filter_xss_admin(variable_get('user_registration_help', '')),
);
}
$affiliates = user_auth_help_links();
if (!$admin && count($affiliates) > 0) {
$affiliates = implode(', ', $affiliates);
$form['affiliates'] = array(
'#value' => '<p>' . t('Note: if you have an account with one of our affiliates (!s), you may <a href="@login_uri">login now</a> instead of registering.', array(
'!s' => $affiliates,
'@login_uri' => url('user'),
)) . '</p>',
);
}
$form = array_merge($form, user_edit_form(NULL, NULL, TRUE));
if ($admin) {
$form['account']['notify'] = array(
'#type' => 'checkbox',
'#title' => t('Notify user of new account'),
);
$form['destination'] = array(
'#type' => 'hidden',
'#value' => $_GET['q'],
);
}
$null = NULL;
$extra = _user_forms($null, NULL, NULL, 'register');
if (!$extra) {
$form['name'] = $form['account']['name'];
$form['mail'] = $form['account']['mail'];
$form['pass'] = $form['account']['pass'];
$form['status'] = $form['account']['status'];
$form['roles'] = $form['account']['roles'];
$form['notify'] = $form['account']['notify'];
unset($form['account']);
}
else {
$form = array_merge($form, $extra);
}
$form['submit'] = array(
'#type' => 'submit',
'#value' => t('Create new account'),
'#weight' => 30,
);
return $form;
}