Index: modules/system.module =================================================================== RCS file: /cvs/drupal/drupal/modules/system.module,v retrieving revision 1.259 diff -u -r1.259 system.module --- modules/system.module 25 Nov 2005 15:26:11 -0000 1.259 +++ modules/system.module 26 Nov 2005 23:06:53 -0000 @@ -47,7 +47,7 @@ * Implementation of hook_perm(). */ function system_perm() { - return array('administer site configuration', 'access administration pages', 'bypass input data check'); + return array('administer site configuration', 'access administration pages', 'bypass input data check', 'can choose theme'); } /** @@ -159,31 +159,37 @@ */ function system_user($type, $edit, &$user, $category = NULL) { if ($type == 'form' && $category == 'account') { - $themes = list_themes(); - ksort($themes); - - // Reset to follow site default theme if user selects the site default - if ($key == variable_get('theme_default', 'bluemarine')) { - $key = ''; - if ($edit['theme'] == variable_get('theme_default', 'bluemarine')) { - $edit['theme'] = ''; + if (user_access('can choose theme')) { + $themes = list_themes(); + ksort($themes); + + // Reset to follow site default theme if user selects the site default + if ($key == variable_get('theme_default', 'bluemarine')) { + $key = ''; + if ($edit['theme'] == variable_get('theme_default', 'bluemarine')) { + $edit['theme'] = ''; + } } - } - $form['themes'] = array( - '#type' => 'fieldset', '#title' => t('Theme configuration'), '#description' => t('Selecting a different theme will change the look and feel of the site.'), '#weight' => 2, '#collapsible' => TRUE, '#theme' => 'system_user'); + $form['themes'] = array( + '#type' => 'fieldset', '#title' => t('Theme configuration'), '#description' => t('Selecting a different theme will change the look and feel of the site.'), '#weight' => 2, '#collapsible' => TRUE, '#theme' => 'system_user'); - foreach ($themes as $info) { - $info->screenshot = dirname($info->filename) . '/screenshot.png'; - $screenshot = file_exists($info->screenshot) ? theme('image', $info->screenshot, t('Screenshot for %theme theme', array('%theme' => $info->name)), '', array('class' => 'screenshot'), false) : t('no screenshot'); + foreach ($themes as $info) { + $info->screenshot = dirname($info->filename) . '/screenshot.png'; + $screenshot = file_exists($info->screenshot) ? theme('image', $info->screenshot, t('Screenshot for %theme theme', array('%theme' => $info->name)), '', array('class' => 'screenshot'), false) : t('no screenshot'); + + $form['themes'][$info->name]['screenshot'] = array('#type' => 'markup', '#value' => $screenshot); + $form['themes'][$info->name]['description'] = array('#type' => 'item', '#title' => $info->name, '#value' => dirname($info->filename)); + $options[$info->name] = ''; + } - $form['themes'][$info->name]['screenshot'] = array('#type' => 'markup', '#value' => $screenshot); - $form['themes'][$info->name]['description'] = array('#type' => 'item', '#title' => $info->name, '#value' => dirname($info->filename)); - $options[$info->name] = ''; + $form['themes']['theme'] = array('#type' => 'radios', '#options' => $options, '#default_value' => $edit['theme'] ? $edit['theme'] : variable_get('theme_default', 'bluemarine')); + + if (count($options) < 2) { + unset($form['themes']); + } } - $form['themes']['theme'] = array('#type' => 'radios', '#options' => $options, '#default_value' => $edit['theme'] ? $edit['theme'] : variable_get('theme_default', 'bluemarine')); - if (variable_get('configurable_timezones', 1)) { $zones = _system_zonelist(); $form['locale'] = array('#type'=>'item', '#title' => t('Locale settings'), '#weight' => 6); Index: modules/user.module =================================================================== RCS file: /cvs/drupal/drupal/modules/user.module,v retrieving revision 1.534 diff -u -r1.534 user.module --- modules/user.module 22 Nov 2005 21:00:40 -0000 1.534 +++ modules/user.module 26 Nov 2005 23:06:55 -0000 @@ -1819,7 +1819,7 @@