diff --git a/includes/form.inc b/includes/form.inc
index 2074d6e51e2b207a01359ffb245a388888c41ccd..a70e00039b2b4706361227165603e04e5da5ea4c 100644
--- a/includes/form.inc
+++ b/includes/form.inc
@@ -134,7 +134,7 @@ function _form_validate(&$elements) {
 
   /* Validate the current input */
   if (!$elements['#validated'] && $elements['#input']) {
-    if ($elements['#required'] && !$elements['#value']) {
+    if ($elements['#required'] && !isset($elements['#value'])) {
         form_error($elements, t('%name field is required', array('%name' => $elements['#title'])));
     }
     if ($elements['#valid']) {
@@ -157,16 +157,53 @@ function _form_validate(&$elements) {
   }
 }
 
+/**
+ * File an error against a form element. If the name of the element is
+ * edit[foo][bar] then you may pass either foo or foo][bar as $name
+ * foo will set an error for all its children.
+ */
+function form_set_error($name = NULL, $message = NULL) {
+  static $form = array();
+  if (isset($name) && !isset($form[$name])) {
+    $form[$name] = $message;
+    drupal_set_message($message, 'error');
+  }
+  return $form;
+}
+
+/**
+ * Return an associative array of all errors.
+ */
+function form_get_errors() {
+  $form = form_set_error();
+  if (!empty($form)) {
+    return $form;
+  }
+}
+
+/**
+ * Return the error message filed against the form with the specified name.
+ */
+function form_get_error($element) {
+  $form = form_set_error();
+  $key = $element['#parents'][0];
+  if (isset($form[$key])) {
+    return $form[$key];
+  }
+  $key = implode('][', $element['#parents']);
+  if (isset($form[$key])) {
+    return $form[$key];
+  }
+}
+
 /**
  * Flag an element as having an error.
  */
 function form_error(&$element, $message) {
   $element['#error'] = TRUE;
-  $GLOBALS['form'][$element['#name']] = $message;
-  drupal_set_message($message, 'error');
+  form_set_error(implode('][', $element['#parents']), $message);
 }
 
-
 /**
  * Adds some required properties to each form element, which are used internally in the form api.
  * This function also automatically assigns the value property from the $edit array, provided the
@@ -348,7 +385,7 @@ function theme_select($element) {
       $select .= '<option value="'. $key .'"'. (is_array($element['#value']) ? (in_array($key, $element['#value']) ? ' selected="selected"' : '') : ($element['#value'] == $key ? ' selected="selected"' : '')) .'>'. check_plain($choice) .'</option>';
     }
   }
-  return theme('form_element', $element['#title'], '<select name="'. $element['#name'] .''. ($element['#multiple'] ? '[]' : '') .'"'. ($element['#multiple'] ? ' multiple="multiple" ' : '') . ($element['#extra'] ? ' '. $element['#extra'] : '') .' id="' . $element['#id'] .'">'. $select .'</select>', $element['#description'], $element['#name'], $element['#required'], _form_get_error($element['#name']));
+  return theme('form_element', $element['#title'], '<select name="'. $element['#name'] .''. ($element['#multiple'] ? '[]' : '') .'"'. ($element['#multiple'] ? ' multiple="multiple" ' : '') . ($element['#extra'] ? ' '. $element['#extra'] : '') .' id="' . $element['#id'] .'">'. $select .'</select>', $element['#description'], $element['#name'], $element['#required'], form_get_error($element));
 }
 
 /**
@@ -386,7 +423,7 @@ function theme_fieldset($element) {
  */
 function theme_radio($element) {
   $output = '<input type="radio" ';
-  $output .= 'class="'. _form_get_class('form-radio', $element['#required'], _form_get_error($element['#name'])) .'" ';
+  $output .= 'class="'. _form_get_class('form-radio', $element['#required'], form_get_error($element)) .'" ';
   $output .= 'name="' . $element['#name'] .'" ';
   $output .= 'value="'. $element['#return_value'] .'" ';
   $output .= ($element['#value'] == $element['#return_value']) ? ' checked="checked" ' : ' ';
@@ -394,7 +431,7 @@ function theme_radio($element) {
   if (!is_null($element['#title'])) {
     $output = '<label class="option">'. $output .' '. $element['#title'] .'</label>';
   }
-  return theme('form_element', NULL, $output, $element['#description'], $element['#name'], $element['#required'], _form_get_error($element['#name']));
+  return theme('form_element', NULL, $output, $element['#description'], $element['#name'], $element['#required'], form_get_error($element));
 }
 
 /**
@@ -408,7 +445,7 @@ function theme_radio($element) {
  */
 function theme_radios($element) {
   if ($element['#title'] || $element['#description']) {
-    return theme('form_element', $element['#title'], $element['#children'], $element['#description'], $element['#id'], $element['#required'], _form_get_error($element['#name']));
+    return theme('form_element', $element['#title'], $element['#children'], $element['#description'], $element['#id'], $element['#required'], form_get_error($element));
   }
   else {
     return $element['#children'];
@@ -426,7 +463,7 @@ function theme_radios($element) {
  */
 function theme_date($element) {
   $output = '<div class="container-inline">' . $element['#children'] . '</div>';
-  return theme('form_element', $element['#title'], $output, $element['#description'], $element['#id'], $element['#required'], _form_get_error($element['#name']));
+  return theme('form_element', $element['#title'], $output, $element['#description'], $element['#id'], $element['#required'], form_get_error($element));
 }
 
 /**
@@ -512,7 +549,7 @@ function theme_item($element) {
 function theme_checkbox($element) {
   $checkbox = '<input ';
   $checkbox .= 'type="checkbox" ';
-  $checkbox .= 'class="'. _form_get_class('form-checkbox', $element['#required'], _form_get_error($element['#name'])) . '" ';
+  $checkbox .= 'class="'. _form_get_class('form-checkbox', $element['#required'], form_get_error($element)) . '" ';
   $checkbox .= 'name="'. $element['#name'] .'" ';
   $checkbox .= 'id="'. $element['#id'].'" ' ;
   $checkbox .= 'value="'. $element['#return_value'] .'" ';
@@ -523,7 +560,7 @@ function theme_checkbox($element) {
     $checkbox = '<label class="option">'. $checkbox .' '. $element['#title'] .'</label>';
   }
 
-  return theme('form_element', NULL, $checkbox, $element['#description'], $element['#name'], $element['#required'], _form_get_error($element['#name']));
+  return theme('form_element', NULL, $checkbox, $element['#description'], $element['#name'], $element['#required'], form_get_error($element));
 }
 
 /**
@@ -536,7 +573,7 @@ function theme_checkbox($element) {
  */
 function theme_checkboxes($element) {
   if ($element['#title'] || $element['#description']) {
-    return theme('form_element', $element['#title'], $element['#children'], $element['#description'], 'edit-'. $element['#name'], $element['#required'], _form_get_error($element['#name']));
+    return theme('form_element', $element['#title'], $element['#children'], $element['#description'], 'edit-'. $element['#name'], $element['#required'], form_get_error($element));
   }
   else {
     return $element['#children'];
@@ -597,8 +634,8 @@ function theme_textfield($element) {
     $extra =  '<input class="autocomplete" type="hidden" id="'. $element['#id'] .'-autocomplete" value="'. check_url(url($element['#autocomplete_path'], NULL, NULL, TRUE)) .'" disabled="disabled" />';
   }
 
-  $output = '<input type="text" maxlength="'. $element['#maxlength'] .'" class="'. _form_get_class("form-text$class", $element['#required'], _form_get_error($element['#name'])) .'" name="'. $element['#name'] .'" id="'. $element['#id'] .'" '. $size .' value="'. check_plain($element['#value']) .'"'. drupal_attributes($element['#attributes']) .' />';
-  return theme('form_element', $element['#title'], $output, $element['#description'], $element['#id'], $element['#required'], _form_get_error($element['#name'])). $extra;
+  $output = '<input type="text" maxlength="'. $element['#maxlength'] .'" class="'. _form_get_class("form-text$class", $element['#required'], form_get_error($element)) .'" name="'. $element['#name'] .'" id="'. $element['#id'] .'" '. $size .' value="'. check_plain($element['#value']) .'"'. drupal_attributes($element['#attributes']) .' />';
+  return theme('form_element', $element['#title'], $output, $element['#description'], $element['#id'], $element['#required'], form_get_error($element)). $extra;
 }
 
 /**
@@ -629,7 +666,7 @@ function theme_form($element) {
 function theme_textarea($element) {
   $cols = $element['#cols'] ? ' cols="'. $element['#cols'] .'"' : '';
 
-  return theme('form_element', $element['#title'], '<textarea'. $cols .' rows="'. $element['#rows'] .'" name="'. $element['#name'] .'" id="' . $element['#id'] .'" class="'. _form_get_class('textarea', $element['#required'], _form_get_error($element['#name'])) .'"'. drupal_attributes($element['#attributes']) .'>'. check_plain($element['#value']) .'</textarea>', $element['#description'], $element['#id'], $element['#required'], _form_get_error($element['#name']));
+  return theme('form_element', $element['#title'], '<textarea'. $cols .' rows="'. $element['#rows'] .'" name="'. $element['#name'] .'" id="' . $element['#id'] .'" class="'. _form_get_class('textarea', $element['#required'], form_get_error($element)) .'"'. drupal_attributes($element['#attributes']) .'>'. check_plain($element['#value']) .'</textarea>', $element['#description'], $element['#id'], $element['#required'], form_get_error($element));
 }
 
 /**
@@ -662,9 +699,9 @@ function theme_markup($element) {
 function theme_password($element) {
   $size = $element['#size'] ? ' size="'. $element['#size'] .'" ' : '';
 
-  $output = '<input type="password" maxlength="'. $element['#maxlength'] .'" class="'. _form_get_class("form-text $class", $element['#required'], _form_get_error($element['#name'])) .'" name="'. $element['#name'] .'" id="'. $element['#id'] .'" '. $size . drupal_attributes($element['#attributes']) .' />';
+  $output = '<input type="password" maxlength="'. $element['#maxlength'] .'" class="'. _form_get_class("form-text $class", $element['#required'], form_get_error($element)) .'" name="'. $element['#name'] .'" id="'. $element['#id'] .'" '. $size . drupal_attributes($element['#attributes']) .' />';
 
-  return theme('form_element', $element['#title'], $output, $element['#description'], $element['#id'], $element['#required'], _form_get_error($element['#name']));
+  return theme('form_element', $element['#title'], $output, $element['#description'], $element['#id'], $element['#required'], form_get_error($element));
 }
 
 /**
@@ -686,23 +723,6 @@ function theme_weight($element) {
   return form_render($element);
 }
 
-/**
- * File an error against the form element with the specified name.
- */
-function form_set_error($name, $message) {
-  $GLOBALS['form'][$name] = $message;
-  drupal_set_message($message, 'error');
-}
-
-/**
- * Return an associative array of all errors.
- */
-function form_get_errors() {
-  if (array_key_exists('form', $GLOBALS)) {
-    return $GLOBALS['form'];
-  }
-}
-
 /**
  * Format a file upload field.
  *
@@ -723,18 +743,8 @@ function form_get_errors() {
  * provided by file.inc.
  */
 function theme_file($element) {
-  return theme('form_element', $element['#title'], '<input type="file" class="'. _form_get_class('form-file', $element['#required'], _form_get_error($element['#name'])) .'" name="'. $element['#name'] .'" id="'. form_clean_id($element['#id']) .'" size="'. $element['#size'] ."\" />\n", $element['#description'], $element['#id'], $element['#required'], _form_get_error($element['#name']));
-}
-
-/**
- * Return the error message filed against the form with the specified name.
- */
-function _form_get_error($name) {
-  if (array_key_exists('form', $GLOBALS)) {
-    return $GLOBALS['form'][$name];
-  }
+  return theme('form_element', $element['#title'], '<input type="file" class="'. _form_get_class('form-file', $element['#required'], form_get_error($element)) .'" name="'. $element['#name'] .'" id="'. form_clean_id($element['#id']) .'" size="'. $element['#size'] ."\" />\n", $element['#description'], $element['#id'], $element['#required'], form_get_error($element));
 }
-
 function _form_get_class($name, $required, $error) {
   return $name. ($required ? ' required' : '') . ($error ? ' error' : '');
 }
diff --git a/includes/locale.inc b/includes/locale.inc
index 40343386999da72798dbb512baf8ddad5f7fefd8..e21de59f58f830b1fc9c18b3f3f14e9ffa9a9ebd 100644
--- a/includes/locale.inc
+++ b/includes/locale.inc
@@ -60,7 +60,7 @@ function _locale_admin_manage_screen() {
       $ratio = ($original->strings > 0 && $translation->translation > 0) ? round(($translation->translation/$original->strings)*100., 2) : 0;
 
       $form['name'][$key] = array('#type' => 'textfield', '#default_value' => $lang, '#size' => 15, '#maxlength' => 64);
-      $form['translation'][$key] = array('#type' => 'markup', '#default_value' => "$translation->translation/$original->strings ($ratio%)");
+      $form['translation'][$key] = array('#type' => 'markup', '#value' => "$translation->translation/$original->strings ($ratio%)");
     }
   }
   $form['enabled'] = array('#type' => 'checkboxes', '#options' => $options, '#default_value' => $enabled, '#return_value' => 1);
@@ -984,7 +984,7 @@ function _locale_string_edit($lid) {
  : array('#type' => 'textfield', '#title' => $languages['name'][$translation->locale], '#default_value' => $translation->translation, '#size' => 60, '#maxlength' => 128);
     unset($languages['name'][$translation->locale]);
   }
-  $form = array('#type' => 'item', '#title' => t('Original text'), '#value' => wordwrap(check_plain($orig, 0)));
+  $form['item'] = array('#type' => 'item', '#title' => t('Original text'), '#value' => wordwrap(check_plain($orig, 0)));
   foreach ($languages['name'] as $key => $lang) {
     $form[$key] = (strlen($orig) > 40) ?
 array('#type' => 'textarea', '#title' => $lang, '#cols' => 60, '#rows' => 15) :
@@ -993,7 +993,7 @@ function _locale_string_edit($lid) {
 
   $form['submit'] = array('#type' => 'submit', '#value' => t('Save translations'));
 
-  return $form;
+  return drupal_get_form('_locale_string_edit', $form);
 }
 
 /**
diff --git a/modules/locale.module b/modules/locale.module
index c41be7a3ccfb8024477605b507f15dc2e5d5cd44..be458bd152169673a958942218a9183f0ec90537 100644
--- a/modules/locale.module
+++ b/modules/locale.module
@@ -108,7 +108,9 @@ function locale_user($type, $edit, &$user, $category = NULL) {
       $user->language = key($languages['name']);
     }
     $languages['name'] = array_map('check_plain', $languages['name']);
-    return array(array('title' => t('Interface language settings'), 'data' => $form['locale_user'] = array('#type' => 'radios', '#title' => t('Language'), '#default_value' => $user->language, '#options' => $languages['name'], '#description' => t('Selecting a different locale will change the interface language of the site.'))));
+    $form['locale'] = array('#title' => t('Interface language settings'), '#type' => 'fieldset', '#weight' => 1);
+    $form['locale']['language'] = array('#type' => 'radios', '#title' => t('Language'), '#default_value' => $user->language, '#options' => $languages['name'], '#description' => t('Selecting a different locale will change the interface language of the site.'));
+    return $form;
   }
 }
 
diff --git a/modules/locale/locale.module b/modules/locale/locale.module
index c41be7a3ccfb8024477605b507f15dc2e5d5cd44..be458bd152169673a958942218a9183f0ec90537 100644
--- a/modules/locale/locale.module
+++ b/modules/locale/locale.module
@@ -108,7 +108,9 @@ function locale_user($type, $edit, &$user, $category = NULL) {
       $user->language = key($languages['name']);
     }
     $languages['name'] = array_map('check_plain', $languages['name']);
-    return array(array('title' => t('Interface language settings'), 'data' => $form['locale_user'] = array('#type' => 'radios', '#title' => t('Language'), '#default_value' => $user->language, '#options' => $languages['name'], '#description' => t('Selecting a different locale will change the interface language of the site.'))));
+    $form['locale'] = array('#title' => t('Interface language settings'), '#type' => 'fieldset', '#weight' => 1);
+    $form['locale']['language'] = array('#type' => 'radios', '#title' => t('Language'), '#default_value' => $user->language, '#options' => $languages['name'], '#description' => t('Selecting a different locale will change the interface language of the site.'));
+    return $form;
   }
 }
 
diff --git a/modules/node.module b/modules/node.module
index 611389ea1743c996f99e3852ffff85d13ed5f9a9..da0f2d9e18a893dfc45fbd727f56b59b250de692 100644
--- a/modules/node.module
+++ b/modules/node.module
@@ -1083,6 +1083,7 @@ function node_types_configure($type = NULL) {
     $form['workflow'] = array('#type' => 'fieldset', '#title' =>t('Workflow'));
     $form['workflow'] = array_merge($form['workflow'], node_invoke_nodeapi($node, 'settings'));
 
+    $form['array_filter'] = array('#type' => 'value', '#value' => TRUE);
     return system_settings_form($type . '_node_settings', $form);
   }
   else {
diff --git a/modules/node/node.module b/modules/node/node.module
index 611389ea1743c996f99e3852ffff85d13ed5f9a9..da0f2d9e18a893dfc45fbd727f56b59b250de692 100644
--- a/modules/node/node.module
+++ b/modules/node/node.module
@@ -1083,6 +1083,7 @@ function node_types_configure($type = NULL) {
     $form['workflow'] = array('#type' => 'fieldset', '#title' =>t('Workflow'));
     $form['workflow'] = array_merge($form['workflow'], node_invoke_nodeapi($node, 'settings'));
 
+    $form['array_filter'] = array('#type' => 'value', '#value' => TRUE);
     return system_settings_form($type . '_node_settings', $form);
   }
   else {
diff --git a/modules/profile.module b/modules/profile.module
index c49a414b734d7c827d872e0a8954ce9d1eefb731..993d70f56f4e449f0643cc55451e34fe5e6e4f60 100644
--- a/modules/profile.module
+++ b/modules/profile.module
@@ -298,7 +298,7 @@ function profile_view_profile($user) {
       $description = ($field->visibility == PROFILE_PRIVATE) ? t('The content of this field is private and only visible to yourself.') : '';
       $title = ($field->type != 'checkbox') ? check_plain($field->title) : '';
       $form = array('#type' => 'item', '#title' => $title, '#value' => $value, '#description' => $description);
-      $fields[$field->category][$field->name] = form_render(_form_builder($form));
+      $fields[$field->category][$field->name] = drupal_get_form('profile_view_profile_' . $field->category .'_'. $field->name, $form, 'profile_view_profile');
     }
   }
 
diff --git a/modules/profile/profile.module b/modules/profile/profile.module
index c49a414b734d7c827d872e0a8954ce9d1eefb731..993d70f56f4e449f0643cc55451e34fe5e6e4f60 100644
--- a/modules/profile/profile.module
+++ b/modules/profile/profile.module
@@ -298,7 +298,7 @@ function profile_view_profile($user) {
       $description = ($field->visibility == PROFILE_PRIVATE) ? t('The content of this field is private and only visible to yourself.') : '';
       $title = ($field->type != 'checkbox') ? check_plain($field->title) : '';
       $form = array('#type' => 'item', '#title' => $title, '#value' => $value, '#description' => $description);
-      $fields[$field->category][$field->name] = form_render(_form_builder($form));
+      $fields[$field->category][$field->name] = drupal_get_form('profile_view_profile_' . $field->category .'_'. $field->name, $form, 'profile_view_profile');
     }
   }
 
diff --git a/modules/system.module b/modules/system.module
index d134a818b45b45541dba94d059e5283b0afdc907..8fd77e98f2816773ccb2779cb7babc6ee1b837e5 100644
--- a/modules/system.module
+++ b/modules/system.module
@@ -188,7 +188,7 @@ function system_user($type, $edit, &$user, $category = NULL) {
       $form['locale'] = array('#type'=>'item', '#title' => t('Locale settings'), '#weight' => 6);
       $form['locale']['timezone'] = array(
         '#type' => 'select', '#title' => t('Time zone'), '#default_value' => strlen($edit['timezone']) ? $edit['timezone'] : variable_get('date_default_timezone', 0),
-        '#options' => $zones, descriptions => t('Select your current local time. Dates and times throughout this site will be displayed using this time zone.')
+        '#options' => $zones, '#description' => t('Select your current local time. Dates and times throughout this site will be displayed using this time zone.')
       );
     }
     return $form;
@@ -684,7 +684,9 @@ function system_settings_form($form_id, $form) {
 /**
  * Execute the system_settings_form.
  *
- * Due to specific handling of checkboxes, this function does not handle 'tree' based forms.
+ * If you want node type configure style handling of your checkboxes,
+ * add an array_filter value to your form.
+ *
  */
 function system_settings_form_execute($form_id, $values) {
   $op = isset($_POST['op']) ? $_POST['op'] : '';
@@ -694,7 +696,7 @@ function system_settings_form_execute($form_id, $values) {
       variable_del($key);
     }
     else {
-      if (is_array($value)) {
+      if (is_array($value) && isset($values['array_filter'])) {
         $value = array_keys(array_filter($value));
       }
       variable_set($key, $value);
@@ -1057,11 +1059,14 @@ function system_theme_settings($key = '') {
     $disabled['toggle_search'] = true;
   }
 
-  $form['toggles'] = array('#type' => 'fieldset', '#title' => t('Toggle display'), '#description' => t('Enable or disable the display of certain page elements.'));
+  $form['theme_settings'] = array('#type' => 'fieldset', '#title' => t('Toggle display'), '#description' => t('Enable or disable the display of certain page elements.'), '#tree' => TRUE);
   foreach ($toggles as $name => $title) {
     if ((!$key) || in_array($name, $features)) {
       // disable search box if search.module is disabled
-      $form['toggles'][$name] = array('#type' => 'checkbox', '#title' => $title, '#default_value' => $settings[$name], '#attributes' =>  isset($disabled[$name]) ? array('disabled' => 'disabled') : NULL);
+      $form['theme_settings'][$name] = array('#type' => 'checkbox', '#title' => $title, '#default_value' => $settings[$name]);
+      if (isset($disabled[$name])) {
+        $form['theme_settings'][$name]['#attributes'] = array('disabled' => 'disabled');
+      }
     }
   }
 
diff --git a/modules/system/system.module b/modules/system/system.module
index d134a818b45b45541dba94d059e5283b0afdc907..8fd77e98f2816773ccb2779cb7babc6ee1b837e5 100644
--- a/modules/system/system.module
+++ b/modules/system/system.module
@@ -188,7 +188,7 @@ function system_user($type, $edit, &$user, $category = NULL) {
       $form['locale'] = array('#type'=>'item', '#title' => t('Locale settings'), '#weight' => 6);
       $form['locale']['timezone'] = array(
         '#type' => 'select', '#title' => t('Time zone'), '#default_value' => strlen($edit['timezone']) ? $edit['timezone'] : variable_get('date_default_timezone', 0),
-        '#options' => $zones, descriptions => t('Select your current local time. Dates and times throughout this site will be displayed using this time zone.')
+        '#options' => $zones, '#description' => t('Select your current local time. Dates and times throughout this site will be displayed using this time zone.')
       );
     }
     return $form;
@@ -684,7 +684,9 @@ function system_settings_form($form_id, $form) {
 /**
  * Execute the system_settings_form.
  *
- * Due to specific handling of checkboxes, this function does not handle 'tree' based forms.
+ * If you want node type configure style handling of your checkboxes,
+ * add an array_filter value to your form.
+ *
  */
 function system_settings_form_execute($form_id, $values) {
   $op = isset($_POST['op']) ? $_POST['op'] : '';
@@ -694,7 +696,7 @@ function system_settings_form_execute($form_id, $values) {
       variable_del($key);
     }
     else {
-      if (is_array($value)) {
+      if (is_array($value) && isset($values['array_filter'])) {
         $value = array_keys(array_filter($value));
       }
       variable_set($key, $value);
@@ -1057,11 +1059,14 @@ function system_theme_settings($key = '') {
     $disabled['toggle_search'] = true;
   }
 
-  $form['toggles'] = array('#type' => 'fieldset', '#title' => t('Toggle display'), '#description' => t('Enable or disable the display of certain page elements.'));
+  $form['theme_settings'] = array('#type' => 'fieldset', '#title' => t('Toggle display'), '#description' => t('Enable or disable the display of certain page elements.'), '#tree' => TRUE);
   foreach ($toggles as $name => $title) {
     if ((!$key) || in_array($name, $features)) {
       // disable search box if search.module is disabled
-      $form['toggles'][$name] = array('#type' => 'checkbox', '#title' => $title, '#default_value' => $settings[$name], '#attributes' =>  isset($disabled[$name]) ? array('disabled' => 'disabled') : NULL);
+      $form['theme_settings'][$name] = array('#type' => 'checkbox', '#title' => $title, '#default_value' => $settings[$name]);
+      if (isset($disabled[$name])) {
+        $form['theme_settings'][$name]['#attributes'] = array('disabled' => 'disabled');
+      }
     }
   }
 
diff --git a/modules/user.module b/modules/user.module
index 6de46309ace116973920511d5ae025e0ac44fe39..a68b0f471411afe52e36568af688d665c50ed9cf 100644
--- a/modules/user.module
+++ b/modules/user.module
@@ -476,7 +476,7 @@ function user_user($type, &$edit, &$user, $category = NULL) {
   }
 
   if ($type == 'validate' && $category == 'account') {
-    return user_edit_validate(arg(1), $edit);
+    return _user_edit_validate(arg(1), $edit);
   }
 
   if ($type == 'categories') {
@@ -1172,7 +1172,7 @@ function user_edit_form($uid, $edit) {
   return $form;
 }
 
-function user_edit_validate($uid, &$edit) {
+function _user_edit_validate($uid, &$edit) {
   // Validate the username:
   if ($error = user_validate_name($edit['name'])) {
     form_set_error('name', $error);
diff --git a/modules/user/user.module b/modules/user/user.module
index 6de46309ace116973920511d5ae025e0ac44fe39..a68b0f471411afe52e36568af688d665c50ed9cf 100644
--- a/modules/user/user.module
+++ b/modules/user/user.module
@@ -476,7 +476,7 @@ function user_user($type, &$edit, &$user, $category = NULL) {
   }
 
   if ($type == 'validate' && $category == 'account') {
-    return user_edit_validate(arg(1), $edit);
+    return _user_edit_validate(arg(1), $edit);
   }
 
   if ($type == 'categories') {
@@ -1172,7 +1172,7 @@ function user_edit_form($uid, $edit) {
   return $form;
 }
 
-function user_edit_validate($uid, &$edit) {
+function _user_edit_validate($uid, &$edit) {
   // Validate the username:
   if ($error = user_validate_name($edit['name'])) {
     form_set_error('name', $error);