user_register
modules/user/user.module, строка 1185
- Версии
- 5 – 6
user_register()
Код
<?php
function user_register() {
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 = array();
// Display the registration form.
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>');
}
// Merge in the default user edit fields.
$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')
);
// Redirect back to page which initiated the create request; usually admin/user/user/create
$form['destination'] = array('#type' => 'hidden', '#value' => $_GET['q']);
}
// Create a dummy variable for pass-by-reference parameters.
$null = NULL;
$extra = _user_forms($null, NULL, NULL, 'register');
// Remove form_group around default fields if there are no other groups.
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;
}
?>
Войдите или зарегистрируйтесь, чтобы получить возможность отправлять комментарии