From 523ba0348ea70e6ed1412488cd37dc521d13abae Mon Sep 17 00:00:00 2001
From: Angie Byron <webchick@24967.no-reply.drupal.org>
Date: Wed, 5 Aug 2009 19:40:55 +0000
Subject: [PATCH] #292253 by Damien Tournoud: Remove per-user themes selection
 from core.

---
 CHANGELOG.txt                   |  2 +
 modules/color/color.module      |  7 ----
 modules/system/system.admin.inc | 22 -----------
 modules/system/system.module    | 67 ---------------------------------
 4 files changed, 2 insertions(+), 96 deletions(-)

diff --git a/CHANGELOG.txt b/CHANGELOG.txt
index d15d1a426a4b..344d9e8a52c9 100644
--- a/CHANGELOG.txt
+++ b/CHANGELOG.txt
@@ -79,6 +79,8 @@ Drupal 7.0, xxxx-xx-xx (development version)
     * Refactored the HTML corrector to take advantage of PHP 5 features.
 - Removed ping module:
     * Contributed modules with similar functionality are available.
+- Removed per-user themes:
+    * Contributed modules with similar functionality are available.
 - Refactored the "access rules" component of user module:
     * The user module now provides a simple interface for blocking single
       IP addresses. The previous functionality in the user module for restricting
diff --git a/modules/color/color.module b/modules/color/color.module
index dab080f399ed..965a9fc8958f 100644
--- a/modules/color/color.module
+++ b/modules/color/color.module
@@ -58,13 +58,6 @@ function color_form_system_themes_alter(&$form, &$form_state) {
   _color_theme_select_form_alter($form, $form_state);
 }
 
-/**
- * Implement hook_form_FORM_ID_alter().
- */
-function color_form_system_theme_select_form_alter(&$form, &$form_state) {
-  _color_theme_select_form_alter($form, $form_state);
-}
-
 /**
  * Helper for hook_form_FORM_ID_alter() implementations.
  */
diff --git a/modules/system/system.admin.inc b/modules/system/system.admin.inc
index cf53356003ad..bc2aba4f928b 100644
--- a/modules/system/system.admin.inc
+++ b/modules/system/system.admin.inc
@@ -2159,28 +2159,6 @@ function theme_system_modules_uninstall($form) {
   return $output;
 }
 
-/**
- * Theme the theme select form.
- * @param $form
- *   An associative array containing the structure of the form.
- * @ingroup themeable
- */
-function theme_system_theme_select_form($form) {
-  foreach (element_children($form) as $key) {
-    $row = array();
-    if (isset($form[$key]['description']) && is_array($form[$key]['description'])) {
-      $row[] = drupal_render($form[$key]['screenshot']);
-      $row[] = drupal_render($form[$key]['description']);
-      $row[] = drupal_render($form['theme'][$key]);
-    }
-    $rows[] = $row;
-  }
-
-  $header = array(t('Screenshot'), t('Name'), t('Selected'));
-  $output = theme('table', $header, $rows);
-  return $output;
-}
-
 /**
  * Theme function for the system themes form.
  *
diff --git a/modules/system/system.module b/modules/system/system.module
index 3443782720a8..e3d01214dceb 100644
--- a/modules/system/system.module
+++ b/modules/system/system.module
@@ -150,10 +150,6 @@ function system_help($path, $arg) {
  */
 function system_theme() {
   return array_merge(drupal_common_theme(), array(
-    'system_theme_select_form' => array(
-      'arguments' => array('form' => NULL),
-      'file' => 'system.admin.inc',
-    ),
     'system_themes_form' => array(
       'arguments' => array('form' => NULL),
       'file' => 'system.admin.inc',
@@ -1380,7 +1376,6 @@ function system_preprocess_page(&$variables) {
  */
 function system_user_form(&$edit, &$user, $category = NULL) {
   if ($category == 'account') {
-    $form['theme_select'] = system_theme_select_form(t('Selecting a different theme will change the look and feel of the site.'), isset($edit['theme']) ? $edit['theme'] : NULL, 2);
     if (variable_get('configurable_timezones', 1)) {
       system_user_timezone($edit, $form);
     }
@@ -1585,68 +1580,6 @@ function system_admin_menu_block($item) {
   return $content;
 }
 
-/**
- * Returns a fieldset containing the theme select form.
- *
- * @param $description
- *    description of the fieldset
- * @param $default_value
- *    default value of theme radios
- * @param $weight
- *    weight of the fieldset
- * @return
- *    a form array
- */
-function system_theme_select_form($description = '', $default_value = '', $weight = 0) {
-  if (user_access('select different theme')) {
-    $enabled = array();
-    $themes = list_themes();
-
-    foreach ($themes as $theme) {
-      if ($theme->status) {
-        $enabled[] = $theme;
-      }
-    }
-
-    if (count($enabled) > 1) {
-      ksort($enabled);
-
-      $form['themes'] = array(
-        '#type' => 'fieldset',
-        '#title' => t('Theme configuration'),
-        '#description' => $description,
-        '#collapsible' => TRUE,
-        '#theme' => 'system_theme_select_form'
-      );
-
-      foreach ($enabled as $info) {
-        // For the default theme, revert to an empty string so the user's theme updates when the site theme is changed.
-        $info->key = $info->name == variable_get('theme_default', 'garland') ? '' : $info->name;
-
-        $screenshot = NULL;
-        $theme_key = $info->name;
-        while ($theme_key) {
-          if (file_exists($themes[$theme_key]->info['screenshot'])) {
-            $screenshot = $themes[$theme_key]->info['screenshot'];
-            break;
-          }
-          $theme_key = isset($themes[$theme_key]->info['base theme']) ? $themes[$theme_key]->info['base theme'] : NULL;
-        }
-
-        $screenshot = $screenshot ? theme('image', $screenshot, t('Screenshot for %theme theme', array('%theme' => $info->name)), '', array('class' => 'screenshot'), FALSE) : t('no screenshot');
-
-        $form['themes'][$info->key]['screenshot'] = array('#markup' => $screenshot);
-        $form['themes'][$info->key]['description'] = array('#type' => 'item', '#title' => $info->name, '#markup' => dirname($info->filename) . ($info->name == variable_get('theme_default', 'garland') ? '<br /> <em>' . t('(site default theme)') . '</em>' : ''));
-        $options[$info->key] = '';
-      }
-
-      $form['themes']['theme'] = array('#type' => 'radios', '#options' => $options, '#default_value' => $default_value ? $default_value : '');
-      $form['#weight'] = $weight;
-      return $form;
-    }
-  }
-}
-
 /**
  * Checks the existence of the directory specified in $form_element. This
  * function is called from the system_settings form to check both the
-- 
GitLab