vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 4.x Add-ons (https://vborg.vbsupport.ru/forumdisplay.php?f=245)
-   -   Integration with vBulletin - Mobile Device & Browser Detection (Adapted by BOP5) (https://vborg.vbsupport.ru/showthread.php?t=292704)

BirdOPrey5 04-09-2015 11:13 AM

Quote:

Originally Posted by Big-K (Post 2542682)
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.

induslady 06-22-2015 08:16 AM

Hello BOP5,

I have installed this plugin and want to make use it such that for tablets I want to show the users desktop style.

The desktop style id is 16 and I used the below plugin
Product: vbulletin
Hook Location : style_fetch

Code:

global $vbulletin;

$tabstyle = 16; //Set this to the id of your mobile style


  if($vbulletin->detect->isTablet())
  {
    $styleid = $tabstyle;
    $_REQUEST['styleid'] = $tabstyle;
    $vbulletin->GPC['styleid'] = $tabstyle;
  }

But it is not working as intended i.e it is showing the mobile style in tablets too.

But I want to show the desktop style in tablets, How do I fix this. Thanks in advance.

induslady 06-23-2015 03:35 AM

Hello all,

Any help is appreciated. Am looking to nail the issue. Thanks.

m2006 08-16-2015 02:29 AM

Not support Search Engine Friendly Archive on vbulletin 4.2.3

you test
Code:

http://www.siteforyou.com/forum/archive/index.php

ruchemist 01-23-2016 08:19 AM

User cannot change style if it is detected as mobile device?

BirdOPrey5 01-23-2016 09:09 AM

Quote:

Originally Posted by ruchemist (Post 2563258)
User cannot change style if it is detected as mobile device?

This mod doesn't force anything, it is only for people writing their own custom code.

boffin_adi 01-27-2017 09:24 AM

Quote:

Originally Posted by BirdOPrey5 (Post 2407577)
Templates use template conditionals...

You can try:

Code:

<vb:if condition="$vbulletin->detect->isMobile()">
Use this HTML code if mobile
</vb:if>

or

Code:

<vb:if condition="$vbulletin->detect->isMobile()">
Use this HTML code if mobile
<vb:else />
Use this code if NOT mobile
</vb:if>



This code this not working in templates

BirdOPrey5 01-27-2017 11:01 PM

What template are you trying? This is very old anyway, not sure how useful it is anymore.

flox80 06-06-2017 11:37 AM

Hi,

On 4.2.4. , I am trying to use this templates :

<vb:if condition="$vbulletin->detect->isMobile()">
{vb:raw test1}
<vb:else />
{vb:raw test2}
</vb:if>

but it doesn't work.

Any idea why?

Thanks.

iA1 09-08-2018 07:10 PM

Quote:

Originally Posted by BirdOPrey5 (Post 2581436)
What template are you trying? This is very old anyway, not sure how useful it is anymore.


I have managed to create a vB 3 version of this, with additional functionality for responsive styles. If you permit, I will release it as a new mod.


All times are GMT. The time now is 08:07 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01088 seconds
  • Memory Usage 1,748KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (4)bbcode_code_printable
  • (2)bbcode_php_printable
  • (4)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (3)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete