UCP Style Preview

issue with override style for guest ? - UCP Style Preview

issue with override style for guest ?

Postby zach' » Mon Nov 01, 2010 6:53 pm

Hi,

Thanks for this great mod,

when i set a new default style in acp + overide user style, it don't works for guest (but it's fine if you log in)

So it seem's not to override the anonymous "user_style", i have some support on french phpbb forum, but after several test on other forums, it seem's not to be the normal behaviour, when the override option is checked (would be normal, if it was not checked) :?

I have searched a long time to find the part of code who is concerned by the overriding style function, and perhaps coul be a relation with your mod

So could you check my includes/session.php with this part of code with your mod change, to see if it could be caused by this change, please

Code: Select all
// BEGIN UCP STYLE PREVIEW MOD
      if (!empty($_GET['style_preview']) && isset($config['style_preview']) && $config['style_preview'])
      {
         global $SID, $_EXTRA_URL;

         $style = request_var('style_preview', 0);
         $SID .= '&style=' . $style;
         $_EXTRA_URL = array('style=' . $style);
      }   
   // following lines were altered, to remove mod replace below with
   // if (!empty($_GET['style']) && $auth->acl_get('a_styles') && !defined('ADMIN_START'))
   // END UCP STYLE PREVIEW MOD

      elseif (!empty($_GET['style']) && $auth->acl_get('a_styles') && !defined('ADMIN_START'))
      {
         global $SID, $_EXTRA_URL;

         $style = request_var('style', 0);
         $SID .= '&style=' . $style;
         $_EXTRA_URL = array('style=' . $style);
      }
      else
      {
         // Set up style
         
         //-- mod: Prime Quick Style -------------------------------------------------//
         include($phpbb_root_path . 'includes/prime_quick_style.' . $phpEx);
         $prime_quick_style->set_guest_style($style);
      //-- end: Prime Quick Style -------------------------------------------------//

         $style = ($style) ? $style : ((!$config['override_user_style']) ? $this->data['user_style'] : $config['default_style']);
      }

      $sql = 'SELECT s.style_id, t.template_storedb, t.template_path, t.template_id, t.bbcode_bitfield, t.template_inherits_id, t.template_inherit_path, c.theme_path, c.theme_name, c.theme_storedb, c.theme_id, i.imageset_path, i.imageset_id, i.imageset_name
         FROM ' . STYLES_TABLE . ' s, ' . STYLES_TEMPLATE_TABLE . ' t, ' . STYLES_THEME_TABLE . ' c, ' . STYLES_IMAGESET_TABLE . " i
         WHERE s.style_id = $style
            AND t.template_id = s.template_id
            AND c.theme_id = s.theme_id
            AND i.imageset_id = s.imageset_id";
      $result = $db->sql_query($sql, 3600);
      $this->theme = $db->sql_fetchrow($result);
      $db->sql_freeresult($result);

      // User has wrong style
      if (!$this->theme && $style == $this->data['user_style'])
      {
         $style = $this->data['user_style'] = $config['default_style'];

         $sql = 'UPDATE ' . USERS_TABLE . "
            SET user_style = $style
            WHERE user_id = {$this->data['user_id']}";
         $db->sql_query($sql);

         $sql = 'SELECT s.style_id, t.template_storedb, t.template_path, t.template_id, t.bbcode_bitfield, c.theme_path, c.theme_name, c.theme_storedb, c.theme_id, i.imageset_path, i.imageset_id, i.imageset_name
            FROM ' . STYLES_TABLE . ' s, ' . STYLES_TEMPLATE_TABLE . ' t, ' . STYLES_THEME_TABLE . ' c, ' . STYLES_IMAGESET_TABLE . " i
            WHERE s.style_id = $style
               AND t.template_id = s.template_id
               AND c.theme_id = s.theme_id
               AND i.imageset_id = s.imageset_id";
         $result = $db->sql_query($sql, 3600);
         $this->theme = $db->sql_fetchrow($result);
         $db->sql_freeresult($result);
      }


Thanks a lot
zach'
Registered User
 
Posts: 44
Joined: Sat Nov 01, 2008 2:07 pm

Re: issue with override style for guest ?

Postby RMcGirr83 » Tue Nov 02, 2010 1:47 am

It would seem to be an issue with the prime quick style not this mod as this mod only is for registered users (the preview is allowed within the User Control Panel which guests do not have).
Assistance with mods | My MODS | Grateful for the mods/support? Then why not buy me a beer

Image
User avatar
RMcGirr83
Former Team Member
 
Posts: 14839
Joined: Wed Jun 22, 2005 4:33 pm
Location: Connecticut USA
Name: Rich McGirr

Re: issue with override style for guest ?

Postby zach' » Tue Nov 02, 2010 10:37 pm

Hide
RMcGirr83 wrote:It would seem to be an issue with the prime quick style not this mod as this mod only is for registered users (the preview is allowed within the User Control Panel which guests do not have).


Thanks a lot, your are right, this mod author just have fixed the bug i have report so ;)
zach'
Registered User
 
Posts: 44
Joined: Sat Nov 01, 2008 2:07 pm