diff options
author | Dries Buytaert <dries@buytaert.net> | 2005-11-13 08:33:44 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2005-11-13 08:33:44 +0000 |
commit | 30059b1a5985fdfe1874e63f4bc5921080449151 (patch) | |
tree | 3369460da597241a8a026953feeb7f36cd98efbd | |
parent | c8f6a2421b0b21dc14805ea262c3b8a97e77c9a5 (diff) | |
download | brdo-30059b1a5985fdfe1874e63f4bc5921080449151.tar.gz brdo-30059b1a5985fdfe1874e63f4bc5921080449151.tar.bz2 |
- Patch #34514 by darius: fixed forms API glitches.
-rw-r--r-- | modules/profile.module | 10 | ||||
-rw-r--r-- | modules/profile/profile.module | 10 |
2 files changed, 10 insertions, 10 deletions
diff --git a/modules/profile.module b/modules/profile.module index d4d2fcb5c..dc626b8d0 100644 --- a/modules/profile.module +++ b/modules/profile.module @@ -349,12 +349,12 @@ function profile_form_profile($edit, $user, $category) { $result = db_query("SELECT * FROM {profile_fields} WHERE LOWER(category) = LOWER('%s') ORDER BY weight", $category); // We use LOWER('%s') instead of PHP's strtolower() to avoid UTF-8 conversion issues. } - // Only add form group if items exist - if (db_num_rows($result)) { - $fields[$category] = array('#type' => 'fieldset', '#title' => $category); - } + while ($field = db_fetch_object($result)) { $category = $field->category; + if (!isset($fields[$category])) { + $fields[$category] = array('#type' => 'fieldset', '#title' => $category, '#weight' => $w++); + } switch ($field->type) { case 'textfield': case 'url': @@ -380,7 +380,7 @@ function profile_form_profile($edit, $user, $category) { $fields[$category][$field->name] = array('#type' => 'select', '#title' => check_plain($field->title), '#default_value' => $edit[$field->name], '#options' => $options, '#description' => _profile_form_explanation($field), '#required' => $field->required); break; case 'date': - $fields[$category][$field->name] = array('#type' => 'date', '#title' => check_plain($field->title), '#default_value' => $edit[$field->name], description, '#description' => _profile_form_explanation($field), '#required' => $field->required); + $fields[$category][$field->name] = array('#type' => 'date', '#title' => check_plain($field->title), '#default_value' => $edit[$field->name], '#description' => _profile_form_explanation($field), '#required' => $field->required); break; } } diff --git a/modules/profile/profile.module b/modules/profile/profile.module index d4d2fcb5c..dc626b8d0 100644 --- a/modules/profile/profile.module +++ b/modules/profile/profile.module @@ -349,12 +349,12 @@ function profile_form_profile($edit, $user, $category) { $result = db_query("SELECT * FROM {profile_fields} WHERE LOWER(category) = LOWER('%s') ORDER BY weight", $category); // We use LOWER('%s') instead of PHP's strtolower() to avoid UTF-8 conversion issues. } - // Only add form group if items exist - if (db_num_rows($result)) { - $fields[$category] = array('#type' => 'fieldset', '#title' => $category); - } + while ($field = db_fetch_object($result)) { $category = $field->category; + if (!isset($fields[$category])) { + $fields[$category] = array('#type' => 'fieldset', '#title' => $category, '#weight' => $w++); + } switch ($field->type) { case 'textfield': case 'url': @@ -380,7 +380,7 @@ function profile_form_profile($edit, $user, $category) { $fields[$category][$field->name] = array('#type' => 'select', '#title' => check_plain($field->title), '#default_value' => $edit[$field->name], '#options' => $options, '#description' => _profile_form_explanation($field), '#required' => $field->required); break; case 'date': - $fields[$category][$field->name] = array('#type' => 'date', '#title' => check_plain($field->title), '#default_value' => $edit[$field->name], description, '#description' => _profile_form_explanation($field), '#required' => $field->required); + $fields[$category][$field->name] = array('#type' => 'date', '#title' => check_plain($field->title), '#default_value' => $edit[$field->name], '#description' => _profile_form_explanation($field), '#required' => $field->required); break; } } |