diff options
-rw-r--r-- | modules/system/system.module | 2 | ||||
-rw-r--r-- | modules/user/user.module | 20 |
2 files changed, 10 insertions, 12 deletions
diff --git a/modules/system/system.module b/modules/system/system.module index 807b80015..7a2667457 100644 --- a/modules/system/system.module +++ b/modules/system/system.module @@ -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', ''), ); diff --git a/modules/user/user.module b/modules/user/user.module index 7c182a561..20f18d824 100644 --- a/modules/user/user.module +++ b/modules/user/user.module @@ -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); |