### Eclipse Workspace Patch 1.0 #P dm-template Index: modules/switchtheme/switchtheme.module =================================================================== --- modules/switchtheme/switchtheme.module (revision 6) +++ modules/switchtheme/switchtheme.module (working copy) @@ -69,11 +69,6 @@ global $custom_theme, $user; drupal_add_css(drupal_get_path('module', 'switchtheme') .'/switchtheme.css'); - // If query parameter 'theme' is set, we always assign a new theme. - if (isset($_REQUEST['theme'])) { - $form = array('values' => array('theme' => $_REQUEST['theme'])); - switchtheme_switch_form_submit('', $form); - } // Other modules may already have set $custom_theme, so we actually switch // the theme only if $custom_theme has not been set yet, or if we are on // administrative pages and admin_theme has been set to "System default" @@ -81,8 +76,11 @@ // object for authenticated users; that value is automatically used across // sessions by Drupal core if the "select different theme" permission has // been granted. - if (isset($_SESSION['custom_theme']) && (!isset($custom_theme) || $custom_theme === '0')) { - $custom_theme = $_SESSION['custom_theme']; + + // If query parameter 'theme' is set, we always assign a new theme. + if (isset($_REQUEST['theme'])) { + $form = array('values' => array('theme' => $_REQUEST['theme'])); + switchtheme_switch_form_submit('', $form); } if (module_exists('browscap') && variable_get('switchtheme_browser_enabled', FALSE)) { @@ -182,11 +180,13 @@ // Otherwise save the setting in the session, just like for anonymous users. else { $_SESSION['custom_theme'] = $form_state['values']['theme']; + $custom_theme = $_SESSION['custom_theme']; } } elseif (user_access('switch theme')) { // Save the setting in the session for anonymous users. $_SESSION['custom_theme'] = $form_state['values']['theme']; + $custom_theme = $_SESSION['custom_theme']; } }