Go Back   vb.org Archive > vBulletin Modifications > vBulletin 4.x Modifications > vBulletin 4.x Add-ons

Reply
 
Thread Tools
Mobile Device & Browser Detection (Adapted by BOP5) Details »»
Mobile Device & Browser Detection (Adapted by BOP5)
Version: 1.00, by BirdOPrey5 (Senior Member) BirdOPrey5 is offline
Developer Last Online: Aug 2023 Show Printable Version Email this Page

Category: Integration with vBulletin - Version: 4.x.x Rating:
Released: 12-05-2012 Last Update: Never Installs: 60
Uses Plugins
Re-useable Code Additional Files  
No support by the author.

This mod has no settings or options.

Installed alone and you will see nothing new.

The purpose of this mod is to bring a reliable way of detecting mobile browsers and devices to vBulletin for use in other mods.

Currently the only mod I know it is recommended for is my Sidebar Anywhere mod.

The bulk of the work of this mod is done by a publicly available PHP Mobile Detection class from:
http://code.google.com/p/php-mobile-detect/

The file name was changed to prevent conflicts but the file contents including license information remains unchanged.

Once installed the mod will allow you to use $vbulletin->detect to detect various mobile options anywhere $vbulletin variable is available in the code.

Its plugin load priority is set to 1 so it executes before all other plugins.

Code:
$vbulletin->options['bop5_mob_detect'] = true; //True if mod enabled/installed

$vbulletin->detect->isMobile()    - true if any mobile device
$vbulletin->detect->isTablet()    - true if tablet
$vbulletin->detect->isiOS()       - true if any iOS device
$vbulletin->detect->isAndroidOS() - true if any Android
------------------------------------------------------

Please "Mark as Installed" if you use this.
Donations always appreciated. :up:
Nominate MOTM if you LOVE it!

Download Now

File Type: zip Mobile Browser Detect v1.zip (13.9 KB, 402 views)

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.
Благодарность от:
RichieBoy67

Comments
  #12  
Old 03-06-2013, 12:01 AM
karabaja3's Avatar
karabaja3 karabaja3 is offline
 
Join Date: Jan 2008
Posts: 143
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Will this work on v3.8.7?
Becuase this one doesn't https://vborg.vbsupport.ru/showthread.php?t=173239
Reply With Quote
  #13  
Old 03-09-2013, 09:42 AM
BirdOPrey5's Avatar
BirdOPrey5 BirdOPrey5 is offline
Senior Member
 
Join Date: Jun 2008
Location: New York
Posts: 10,610
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Only for 4.x, sorry.
Reply With Quote
  #14  
Old 03-10-2013, 05:53 PM
ivanp ivanp is offline
 
Join Date: Sep 2007
Posts: 30
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Nice mod

I suggest changing the hook to "init_startup" to be able to replace default mobile browser detection in init.php with:

Code:
if($vbulletin->options['bop5_mob_detect'])
{
	$mobile_browser = $vbulletin->detect->isMobile();
	if($mobile_browser && $vbulletin->detect->isTablet()) $mobile_browser = false;
	$mobile_browser_advanced = $mobile_browser;
}
That way tablets will not be considered as mobile devices, thus not being served mobile style as default style.
Reply With Quote
Благодарность от:
BirdOPrey5
  #15  
Old 06-09-2013, 11:25 AM
Budget101 Budget101 is offline
 
Join Date: Jul 2008
Posts: 331
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by ivanp View Post
Nice mod

I suggest changing the hook to "init_startup" to be able to replace default mobile browser detection in init.php with:

Code:
if($vbulletin->options['bop5_mob_detect'])
{
    $mobile_browser = $vbulletin->detect->isMobile();
    if($mobile_browser && $vbulletin->detect->isTablet()) $mobile_browser = false;
    $mobile_browser_advanced = $mobile_browser;
}
That way tablets will not be considered as mobile devices, thus not being served mobile style as default style.
wouldn't removing the following line do the same thing??

Code:
$vbulletin->detect->isTablet()    - true if tablet
Reply With Quote
  #16  
Old 06-09-2013, 11:34 AM
Toorak Times's Avatar
Toorak Times Toorak Times is offline
 
Join Date: Jan 2011
Posts: 436
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hey BOP, does this make our videos and stuff work on iPhones and pads?
Reply With Quote
  #17  
Old 06-09-2013, 03:24 PM
BirdOPrey5's Avatar
BirdOPrey5 BirdOPrey5 is offline
Senior Member
 
Join Date: Jun 2008
Location: New York
Posts: 10,610
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Toorak Times View Post
Hey BOP, does this make our videos and stuff work on iPhones and pads?
No- it merely detects if it is a mobile browser or not- it does nothing without custom coding.

However to have YouTube and other videos work on iPhones and stuff check out these HTML 5 changes- https://vborg.vbsupport.ru/showthread.php?t=283594
Reply With Quote
  #18  
Old 07-31-2013, 06:57 PM
behcet behcet is offline
 
Join Date: Apr 2007
Posts: 37
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

upgrade pls
Reply With Quote
  #19  
Old 07-31-2013, 09:45 PM
datoneer datoneer is offline
 
Join Date: Jul 2011
Posts: 453
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks, installed, nominated
Reply With Quote
  #20  
Old 08-16-2013, 06:38 AM
Okuma Steve Okuma Steve is offline
 
Join Date: May 2010
Posts: 32
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Just installed this on my site and it is treating all my devices as desktop browsers and not mobile. Any ideas on why that may be?

I've tested it with a nexus 4, nexus 7, and an Ipad 1

I'm using this to hide a footer ad from mobile users:

PHP Code:
<vb:if condition="!$vboptions['isMobile']">

code code code

</vb:if> 
Reply With Quote
  #21  
Old 08-17-2013, 10:41 AM
BirdOPrey5's Avatar
BirdOPrey5 BirdOPrey5 is offline
Senior Member
 
Join Date: Jun 2008
Location: New York
Posts: 10,610
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Okuma Steve View Post
Just installed this on my site and it is treating all my devices as desktop browsers and not mobile. Any ideas on why that may be?

I've tested it with a nexus 4, nexus 7, and an Ipad 1

I'm using this to hide a footer ad from mobile users:

PHP Code:
<vb:if condition="!$vboptions['isMobile']">

code code code

</vb:if> 
Did you follow the instructions in post #4? $vboptions['isMobile'] isn't going to exist if you don't set the value via a plugin first.
Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 11:38 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.08338 seconds
  • Memory Usage 2,341KB
  • Queries Executed 28 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (4)bbcode_code
  • (2)bbcode_php
  • (3)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (4)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (3)pagenav_pagelink
  • (11)post_thanks_box
  • (2)post_thanks_box_bit
  • (11)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (2)post_thanks_postbit
  • (11)post_thanks_postbit_info
  • (10)postbit
  • (1)postbit_attachment
  • (11)postbit_onlinestatus
  • (11)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • fetch_musername
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • post_thanks_function_fetch_thanks_bit_start
  • post_thanks_function_show_thanks_date_start
  • post_thanks_function_show_thanks_date_end
  • post_thanks_function_fetch_thanks_bit_end
  • post_thanks_function_fetch_post_thanks_template_start
  • post_thanks_function_fetch_post_thanks_template_end
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_attachment
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete