summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAngie Byron <webchick@24967.no-reply.drupal.org>2009-06-28 12:52:57 +0000
committerAngie Byron <webchick@24967.no-reply.drupal.org>2009-06-28 12:52:57 +0000
commit3bf1c719f5c9306cd42f51119a3491bf43e49a20 (patch)
tree4fda3c3ff01d1f44ac654764a3801eec4d1e2b47
parent59339ea1f49f4bed1797d02a7f80750989cebd0f (diff)
downloadbrdo-3bf1c719f5c9306cd42f51119a3491bf43e49a20.tar.gz
brdo-3bf1c719f5c9306cd42f51119a3491bf43e49a20.tar.bz2
#460706 by wulff and c960657: Don't show surrounding fieldset on user registration form when only one profile category exists.
-rw-r--r--modules/system/system.module2
-rw-r--r--modules/user/user.module20
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);