Quote:
Originally Posted by Big-K
To earlier question, how do you use this to change styles?
|
Create a plugin on the style_fetch hook...
Code would be:
PHP Code:
global $vbulletin;
$mobilestyle = 38; //Set this to the id of your mobile style
if($vbulletin->detect->isMobile())
{
$styleid = $mobilestyle;
$_REQUEST['styleid'] = $mobilestyle;
$vbulletin->GPC['styleid'] = $mobilestyle;
}
That is a bare bones plugin. It will change to the mobile style if a mobile device is detected. The problem is that no one could ever change back to the regular style on a mobile device. You probably want to add some code to deal with that.
For example if you are doing this to appease Google then maybe you only want to make this plugin active if it's a guest viewing the site, and not a registered member. In that case add a check to the conditional-
PHP Code:
global $vbulletin;
$mobilestyle = 38; //Set this to the id of your mobile style
if($vbulletin->detect->isMobile() AND $vbuletin->userinfo['usergroupid'] == 1)
{
$styleid = $mobilestyle;
$_REQUEST['styleid'] = $mobilestyle;
$vbulletin->GPC['styleid'] = $mobilestyle;
}
usergroupid 1 is the guest usergroup.
If you want to get fancier you can use a cookie or something.