Hi,

this is great module, but i found out a bug: if you change theme as anonymous, theme name is stored into $_SESSION['custom_theme'].
If you then login $_SESSION['custom_theme'] is still stored and switchtheme module loads theme name from session not from $user->theme. So we need to prefer value $user->theme instead $_SESSION['custom_theme'].

Patch is simply (in dev version) :
118 row switchtheme.module
- if (isset($_SESSION['custom_theme'])) {
+ if (empty($user->theme) && isset($_SESSION['custom_theme'])) {

If you confirm this, it could be added to dev module.

Comments

bradwade’s picture

Status: Patch (to be ported) » Needs review
StatusFileSize
new562 bytes

The above changed worked for me. Here is a patch for it from the 1.0 tag.

dgale’s picture

This same bug exists in the 6.x version of the code, including the latest dev.

The same fix works to correct the problem. The only difference is the problem is at line 84 in switchtheme.module:

- if (isset($_SESSION['custom_theme']) && (!isset($custom_theme) || $custom_theme === '0')) {
+ if (empty($user->theme) && isset($_SESSION['custom_theme']) && (!isset($custom_theme) || $custom_theme === '0')) {

Cory Goodwin’s picture

Status: Needs review » Patch (to be ported)

Bradewade's patch works for me.

patch to be ported?

Egmund’s picture

Status: Needs work » Patch (to be ported)
Egmund’s picture

Status: Patch (to be ported) » Needs work

Well . .
I changed line 118, but seemingly no change for me.

If I log out, switch the theme, log back in, then I still can not switch the theme.

I need to delete the sesshin cookie just as before the patch.

So, still a major bug!

Status: Patch (to be ported) » Needs work
xoruna’s picture

Issue summary: View changes

I applied the patch, it works for me. Thanks