I'm using switchtheme to present a particular theme to anonymous browsers (with no editing rights), and allow authenticated users to switch between that and a theme which works better for staff and light administration - which allows a quick preview of how the site looks to the outside world.

Using 5.x-1.x-dev

What I've found is that any logged in staff, upon changing themes - sets the site default to their chosen theme when they toggle it. This changes the entire site (including anonymous browsers) to use whatever they have selected. Any logged in user thus immediately changes the default for everybody else.

I have commented out the 'theme_default' setting in switchtheme_switch_form_submit() [below] to fix this issue, as I feel that it is a bug. Perhaps this is different usage than what was intended, but I don't see how it could be considered correct behavior.

  // save the setting in the db for logged in users
  // save the setting in the variable for all others
  if ($user->uid > 0) {
//??????    variable_set('theme_default', $form_values['custom_theme']);
    if (user_save($user, array('theme' => $form_values['custom_theme']))) {
      $user->theme = $form_values['custom_theme'];
    }
  }

Comments

sun’s picture

Status: Active » Closed (duplicate)