#460706 by wulff and c960657: Don't show surrounding fieldset on user registration form when only one profile category exists.

merge-requests/26/head
Angie Byron 2009-06-28 12:52:57 +00:00
parent 59339ea1f4
commit 3bf1c719f5
2 changed files with 10 additions and 12 deletions

View File

@ -913,7 +913,7 @@ function system_user_register(&$edit, &$user, $category = NULL) {
system_user_timezone($edit, $form);
}
else {
$form['timezone'] = array(
$form['account']['timezone'] = array(
'#type' => 'hidden',
'#value' => variable_get('user_default_timezone', DRUPAL_USER_TIMEZONE_DEFAULT) ? '' : variable_get('date_default_timezone', ''),
);

View File

@ -2893,18 +2893,16 @@ function user_register() {
// 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) {
foreach (array('name', 'mail', 'pass', 'status', 'roles', 'notify') as $key) {
if (isset($form['account'][$key])) {
$form[$key] = $form['account'][$key];
}
}
unset($form['account']);
if ($extra) {
$form = array_merge_recursive($form, $extra);
}
else {
$form = array_merge($form, $extra);
// 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);