Themes don't switch for anonymous users

kulfi - October 21, 2007 - 06:54
Project:Switchtheme
Version:5.x-1.x-dev
Component:Code
Category:bug report
Priority:critical
Assigned:sun
Status:closed
Description

Switching themes using the drop down works for logged in users, but not for others.

#1

sun - November 29, 2007 - 04:28
Version:6.x-1.x-dev» 5.x-1.x-dev
Assigned to:Anonymous» sun
Status:active» needs review

Attached patch should fix this issue for 5.x.
6.x can come later.

AttachmentSize
switchtheme-DRUPAL-5.anonymous.patch 2.99 KB

#2

wd - December 9, 2007 - 13:14

I've made some patch for Drupal-6.x.
The patch is:-

<?php
--- switchtheme.module  2007-08-31 21:56:14.000000000 +0700
+++ switchtheme/switchtheme.module  2007-12-09 19:46:14.000000000 +0700
@@ -148,11 +148,17 @@ function switchtheme_switch_form_submit(
  
// save the setting in the db for logged in users
   // save the setting in the session for all others
  
if ($user->uid > 0) {
-   
variable_set('theme_default', $form_values['custom_theme']);
+   
// FIX DEFAULT THEME CHANGED
+    //variable_set('theme_default', $form_values['custom_theme']);
    
if (user_save($user, array('theme' => $form_state['values']['custom_theme']))) {
      
$user->theme = $form_state['values']['custom_theme'];
     }
   }
// FIX ANONYMOUS SWITCH THEME
+  elseif (user_access('switch theme')) {
+   
// save the setting in the variable for all others
+    $_SESSION['custom_theme'] = $form_state['values']['custom_theme'];
+  }
}


@@ -
184,4 +190,4 @@ function switchtheme_select() {
   }
  
asort($select);
   return
$select;
-}
No newline at end of file
+}
?>

#3

marcoBauli - February 27, 2008 - 00:02
Status:needs review» reviewed & tested by the community

the patch applies and fixes the problem on 5.x thanks!

#4

dr00b - March 6, 2008 - 20:12

Worked for me as well (as soon as I figured out how to apply a patch).

#5

Wolfflow - April 11, 2008 - 22:35

Hi, have applied your patch (#2) to switchtheme on following demo Site:
Drupal Themes Showcase
it works ;-) : Site use Drupal 6.1 and all recommended D6 Themes.

But I need to click twice on the page , that means that i have to change for example
clicking primary_menus: from --> home --> to --> Gallery
to see the Theme change.

Is this normal?
anyway it does what i need for this Themes Demo Site!

Thanks!

Some days later!! I spoke victory to early:

I just went through many Browser Test and find out that there is still a bug.
It seems that the module using it for anonymous user get in conflict with "cookies" and cache settings of the browser you use: Safari - Opera the most affected.

So if anyone have a suggestion?

#6

Wolfflow - April 11, 2008 - 22:34
Priority:normal» critical
Status:reviewed & tested by the community» needs review

I have to change status from normal to critical. Tested on http://www.adaccs.at/drupal/

#7

crashovermind - March 15, 2008 - 13:17

thx a lot, you fixed my Drupal 6 Problem !

greetz
David

#8

Wolfflow - April 11, 2008 - 22:34

Hi crashovermind,

It would be nice to have some details on your solved issue. I'm working on a Theme Demo Site for the Community
address : http://www.adaccs.at/drupal/
and will collect infos about each Theme for D6.x(recommended). You aopinion is Welcome! Thanks

P.S.Link corrected

#9

undoIT - April 11, 2008 - 21:42
Title:themes don't switched for anonymous users» themes don't switch for anonymous users
Version:5.x-1.x-dev» 6.x-1.x-dev

The patch for Drupal-6.x does work with the dropdown. However, changing themes via URL still does not work. When adding &theme= to the URL, themes do not change in the same way they did with Drupal 4.7 and Drupal 5. As anybody gotten this working with URL?

#10

Wolfflow - April 11, 2008 - 22:46

Hi All, just wnat to precise that on my comments #5 #6 #8 above I have corrected the link. The original Site does not exist anymore but is still my intention to apply Switchtheme.module on the new site on:

http://adaccs.at/drupal/ , this site is based on Drupal 6.2 and is in costruction. Drupal Themes D4,D5, screenshots gallery have been completed, D6 Themes Screenshots will soon follow. My intention is to build a voting sistem that define the best and most used and spread Themes wich will be applyed on the Site, therefore the module will be neded.

Any help are very much appreciate, I'm some how confident with Drupal but there is a lot of lack of knowledge with PHP.

Thank you for your attention
Cheers

#11

undoIT - April 12, 2008 - 01:58

You can also preview Drupal themes here:

http://themebot.com/website-templates/drupal-themes

All of the new Drupal 6 themes will be added once the URL function for Switchtheme is fixed.

#12

sun - April 13, 2008 - 19:46
Title:themes don't switch for anonymous users» Themes don't switch for anonymous users
Version:6.x-1.x-dev» 5.x-1.1

New patch against DRUPAL-5. Please test, so I can re-roll it for D6 afterwards.

AttachmentSize
switchtheme-DRUPAL-5.anonymous.patch 3.56 KB

#13

undoIT - April 15, 2008 - 07:56

Let me know when you've got the Drupal 6 patch ready. I'll give it a thorough testing :)

#14

sun - April 16, 2008 - 00:43

Since SwitchTheme's userbase is small, I've created a patch for D6. However, it's just the code, I haven't tested it.

AttachmentSize
switchtheme-DRUPAL-6--1.patch 3.29 KB

#15

sun - April 16, 2008 - 17:57

#247348: Switchtheme switches the default theme not the users' has not only been marked as duplicate, but also confirms that this patch (for D5) works. Another test would be great, though.

#16

undoIT - April 17, 2008 - 08:22

Alright! Switching themes by URL is working. I'll do some more testing tomorrow.

#17

Wolfflow - April 19, 2008 - 03:21

Subscribe

#18

sun - April 20, 2008 - 02:01

I still need at least one more qualified review to commit this. Thanks.

#19

SeanA - April 20, 2008 - 16:28
Version:5.x-1.1» 5.x-1.x-dev

Changing affected version, this problem does not occur on 5.x-1.1. The patch in #12 does seem to fix the problem for 5.x-1.x-dev.

#20

undoIT - April 20, 2008 - 19:23

Hi sun. I've tested the Drupal 6 patch pretty thoroughly and everything seems to be working. Works for both anonymous and authenticated users. The switchtheme block is working. And, URL method works. There are a few Drupal 6 themes which do not work even though they are enabled in the Theme manager (do not appear in the drop down and can't be called via URL). I am thinking this is a problem with those specific themes, rather than switchtheme.

#21

sun - April 20, 2008 - 20:34
Status:needs review» fixed

Thanks all, committed.

#22

stephthegeek - May 2, 2008 - 20:54
Status:fixed» active

I seem to be having a related problem. Same problem is occurring with both 1.1 and dev, which is odd. I'm running a 4-site multisite setup with the same copy of the switchtheme module, and only ONE of my sites has the problem where anonymous users cannot switch the theme, either via the dropdown or by URL. I've triple checked permissions, upgraded, downgraded... any ideas for troubleshooting this further?

#23

sun - May 9, 2008 - 14:21
Status:active» fixed

@stephthegeek: Must be related to your multi-site setup. Please open a new issue. This one has been fixed.

#24

Anonymous (not verified) - May 23, 2008 - 14:22
Status:fixed» closed

Automatically closed -- issue fixed for two weeks with no activity.

#26

skoledin - November 2, 2009 - 00:56

As of switchtheme-6.x-1.1 it looks like this is still an issue for anonymous users. The following patch isn't a perfect solution, but it did what I wanted and provided enough permission granularity for my use. Just tacking it on here in case anyone else is still looking for a quick fix.

AttachmentSize
switchtheme.module.anon_.patch 447 bytes
 
 

Drupal is a registered trademark of Dries Buytaert.