PDA

View Full Version : View User's Current Style/ThemeID..


Ad1tya
11-25-2008, 02:29 AM
Hi.

Is there any way to check a users current style selection?

We want to make a button on our forums, which will alternate between Fixed Width and Fluid Width.

We have a Dark and a Light Theme.

Regards,
Ad1tya.

KiD0M4N
11-25-2008, 04:23 AM
What he wants to know is is there some way to get the currently active style id.

ReCom
11-25-2008, 04:46 AM
Each style/theme has its own "StyleVars" page in AdminCP > Style Manager. Within that page there is a section titled "Image Paths" where paths for various types of images can be modified for that particular style:


Button Images Folder
Item Status Icon Folder
Attachment Icons Folder
Miscellaneous Images Folder
Text Editor Controls Folder
Poll Images Folder
Ratings Images Folder
Reputation Images Folder

You can put the buttons for dark theme in, say /images/dark/buttons and point "Button Images Folder" to that folder. Users who browse in that dark theme will see button images from that folder while those browsing in default style will see the default buttons.

But if you still want to access the style id from plugins or templates, it's $vbulletin->userinfo['styleid']

KiD0M4N
11-25-2008, 05:03 AM
Each style/theme has its own "StyleVars" page in AdminCP > Style Manager. Within that page there is a section titled "Image Paths" where paths for various types of images can be modified for that particular style:


Button Images Folder
Item Status Icon Folder
Attachment Icons Folder
Miscellaneous Images Folder
Text Editor Controls Folder
Poll Images Folder
Ratings Images Folder
Reputation Images Folder

You can put the buttons for dark theme in, say /images/dark/buttons and point "Button Images Folder" to that folder. Users who browse in that dark theme will see button images from that folder while those browsing in default style will see the default buttons.

But if you still want to access the style id from plugins or templates, it's $vbulletin->userinfo['styleid']

Thanks a LOT bro :)

--------------- Added 1227596983 at 1227596983 ---------------

Each style/theme has its own "StyleVars" page in AdminCP > Style Manager. Within that page there is a section titled "Image Paths" where paths for various types of images can be modified for that particular style:


Button Images Folder
Item Status Icon Folder
Attachment Icons Folder
Miscellaneous Images Folder
Text Editor Controls Folder
Poll Images Folder
Ratings Images Folder
Reputation Images Folder

You can put the buttons for dark theme in, say /images/dark/buttons and point "Button Images Folder" to that folder. Users who browse in that dark theme will see button images from that folder while those browsing in default style will see the default buttons.

But if you still want to access the style id from plugins or templates, it's $vbulletin->userinfo['styleid']

Hi... unfortunately the code is not working. I am unable to get the styleid.

Lynne
11-25-2008, 03:07 PM
Hi... unfortunately the code is not working. I am unable to get the styleid.
If something doesn't work and you need help with it, you need to post the code (including the code location).

ReCom
11-25-2008, 10:14 PM
Yup, $vbulletin is the core vbulletin registry object; you can't miss it except for one possible reason:

You tried to access it from withn a function but forgot to do "global $vbulletin;" first

function blah()
{
global $vbulletin;
doSomething->to($vbulletin->userinfo['styledid'];
}

Or if your code is in the form of a plugin, and the hook location happens to fall inside a class function, try using this instead:$this->registry->userinfo['styleid']