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)
-   -   Add-On Releases - VB4 - Mobile Phone / iPhone / PDA Detection and Style Assignment (https://vborg.vbsupport.ru/showthread.php?t=249967)

siriuxs 02-25-2011 11:41 AM

Hi, I have a problem (excuse me for bad english...)... I have installed this plugin and relative style... If I go on my forum.hdblog.it from my iphone i visualized the desktop template... :( If i login in the forum is visualized correctly the mobile version... why is visualized the desktop version if I not logged in?

Thanks

kether1 02-26-2011 02:42 PM

I would like this to work for iPod and iPhone, but I do not want the iPad to automacally go to the mobile site. If I put iPad in the box at the bottom of this modification, will that solve that issue? I don't own an iPad, but a user emailed and said that s/he really hates that my site assigns the mobile style to the iPad when it used to be the regular PC version with more features.

Thanks for this!
Kether

dartho 02-26-2011 10:59 PM

Quote:

Originally Posted by kether1 (Post 2167129)
If I put iPad in the box at the bottom of this modification, will that solve that issue?

I don't own any "i" devices to test, but I believe it should ...

kether1 02-28-2011 08:04 PM

Quote:

Originally Posted by dartho (Post 2167357)
I don't own any "i" devices to test, but I believe it should ...

Thank you!

WinnipegHeights 03-07-2011 02:21 AM

Any ETA on an update for this to work with 4.1+?

bigrover 03-07-2011 03:58 PM

I have also tried this on my vB 4.1.2 pre-release site and it doesn't auto-detect any longer on my Blackberry 6 OS. It works great on vB 4.0.8. I suspect part of the problem is the built-in browser detection in vB4.1.2 for the new Mobile style. I suspect it is over-riding this hack.

I tried the new Mobile style that is released with vB 4.1.2 but ran into problems. Apparently it does not play well with mods and hacks. In my case, it shows up on the mobile device or the desktop fine, but I cannot navigate to any forums because the links are not working. I can navigate to the options and other settings, but not within the forums themselves. It looks like I will have to abandon mobile style detection for my site if I choose to upgrade to vB 4.1.2 to resolve other security and database searching issues.

McCarron 03-29-2011 06:43 PM

Newly installed and having a slight problem with only Android devices, which was mentioned earlier in the forum, but never resolved. The device I use for testing runs Froyo.

Basically after the first page visit you get the mobile style but then all secondary pages get set to the default style. The only way to prevent that is to enable your new "Enable Over-riding of Styles" option. That's nice that it fixes the other issue but that option prevents users from switching to the Desktop version.

So it fixes a bug but removes a feature from the plugin to allow users to use the regular view.

Any thoughts or ideas?

dartho 03-29-2011 09:17 PM

This is working as it is meant to on my site from my phone.

Now that vBulletin has built in mobile device detection, you should probably use that over this if you wish to allow overriding of the mobile detection, they also have to support you if/when you run into issues.

McCarron 03-30-2011 07:56 PM

Quote:

Originally Posted by dartho (Post 2178867)
This is working as it is meant to on my site from my phone.

Now that vBulletin has built in mobile device detection, you should probably use that over this if you wish to allow overriding of the mobile detection, they also have to support you if/when you run into issues.

I'm sorry I thought this plugin was still supported? It says so right at the top of the page. You may want to change that if you are no longer providing support in lieu vBulletin's new feature. I would happily use vBulletin's implementation if I was on their latest version, but I am not and don't have plans to move at this time.

Well anyone else interested, this plugin has a glitch when certain Android devices visit. Here is how you can fix it to work for them:

You have to Disable the Enable Over-riding of Styles option. Mobile Users now will be forced into the mobile theme, but wont be able to switch to the regular site anymore. SO if you are also using dartho's Lightweight Style and Options theme/plugin system you need to disable the Add a link to the default style? option in Lightweight Style Options as the user will not be able to switch styles anymore.

It's a bad experience for all mobile users to be forced into the mobile theme, but it's the only way I could get this plugin to work for the various types of users navigating to our site.

Also here are some additional useragents I check for that allow Android and HP/Palm webOS phones to be detected properly. It also detects the iPhone Simulator so those of you with the iPhone SDK can test the iPhone layout easily on your Mac.

Quote:

WebOS,webOS,Simulator,Android
I also have excluded "iPad" from the exclusions list because the iPad doesn't need a mobile theme as it's screen is plenty large, but it automatically gets lumped into the iPhone devices by default.

dartho 03-30-2011 11:53 PM

I didnt say I wasn't supporting it, I just made a suggestion. My next (based on you not using version 4.1.2) would be to download version 4.1.2 and take their detection code out and put it in a plugin to test if it is effective on your device.

I've done this for you.
Edit the Detect Mobile Device and Assign Style plugin
Comment out the existing code (by putting a /* at the very start, and a */ at the very end of it)
Paste in the following code at the start
PHP Code:

$vbulletin->input->clean_array_gpc('c', array(
    
COOKIE_PREFIX 'userstyleid'     => TYPE_UINT,
    
COOKIE_PREFIX 'skipmobilestyle' => TYPE_BOOL,
));

// Test mobile browser
$mobile_browser false;
$mobile_browser_advanced false;
if (
$vbulletin->options['mob_detect_enabled'])
{
    if (
stripos($_SERVER['HTTP_USER_AGENT'], 'windows') === false)
    {
        if (
            
preg_match('/(up.browser|up.link|mmp|symbian|smartphone|midp|wap|phone|android)/i'strtolower($_SERVER['HTTP_USER_AGENT']))
            OR
            
stripos($_SERVER['HTTP_ACCEPT'],'application/vnd.wap.xhtml+xml') !== false
            
OR
            ((isset(
$_SERVER['HTTP_X_WAP_PROFILE']) OR isset($_SERVER['HTTP_PROFILE'])))
            OR
            
stripos($_SERVER['ALL_HTTP'],'OperaMini') !== false
        
)
        {
            
$mobile_browser true;
        }
        
// This array is big and may be bigger later on. So we move it to a second if.
        
elseif (in_array(
                    
strtolower(substr($_SERVER['HTTP_USER_AGENT'], 04)),
                    array(
                    
'w3c ','acs-','alav','alca','amoi','audi','avan','benq','bird','blac',
                    
'blaz','brew','cell','cldc','cmd-','dang','doco','eric','hipt','inno',
                    
'ipaq','java','jigs','kddi','keji','leno','lg-c','lg-d','lg-g','lge-',
                    
'maui','maxo','midp','mits','mmef','mobi','mot-','moto','mwbp','nec-',
                    
'newt','noki','oper','palm','pana','pant','phil','play','port','prox',
                    
'qwap','sage','sams','sany','sch-','sec-','send','seri','sgh-','shar',
                    
'sie-','siem','smal','smar','sony','sph-','symb','t-mo','teli','tim-',
                    
'tosh','tsm-','upg1','upsi','vk-v','voda','wap-','wapa','wapi','wapp',
                    
'wapr','webc','winw','winw','xda ','xda-')
                )
            )
        {
            
$mobile_browser true;
        }
    }

    if (
        
$mobile_browser
        
AND
        
preg_match('/(ipad|ipod|iphone|blackberry|android|pre\/|palm os|palm|hiptop|avantgo|plucker|xiino|blazer|elaine)/i'strtolower($_SERVER['HTTP_USER_AGENT']))
    )
    {
        
$mobile_browser_advanced true;
    }
}
$vbulletin->input->clean_array_gpc('r', array(
    
'styleid' => TYPE_INT,
    
'langid'  => TYPE_INT,
));


// Set up user's chosen style
if ($vbulletin->GPC['styleid'])
{
    
$styleid =& $vbulletin->GPC['styleid'];
    
vbsetcookie('userstyleid'$styleid);
    if (
$styleid == -1)
    {
        
vbsetcookie('skipmobilestyle'1);
        
$vbulletin->GPC[COOKIE_PREFIX 'skipmobilestyle'] = 1;
    }
    elseif (
$styleid == $vbulletin->options['ipod_skin_enabled'] OR $styleid == $vbulletin->options['mobile_skin_enabled'])
    {
        
vbsetcookie('skipmobilestyle'0);
        
$vbulletin->GPC[COOKIE_PREFIX 'skipmobilestyle'] = 0;
    }
}
elseif (
$mobile_browser_advanced && $vbulletin->options['ipod_skin_enabled'] && !$vbulletin->GPC[COOKIE_PREFIX 'skipmobilestyle'])
{
    
$styleid $vbulletin->options['ipod_skin'];
}
elseif (
$mobile_browser && $vbulletin->options['mobile_skin_enabled'] && !$vbulletin->GPC[COOKIE_PREFIX 'skipmobilestyle'])
{
    
$styleid $vbulletin->options['mobile_skin'];
}
elseif (
$vbulletin->GPC[COOKIE_PREFIX 'userstyleid'])
{
    
$styleid $vbulletin->GPC[COOKIE_PREFIX 'userstyleid'];
}
else
{
    
$styleid 0;


Save

Whilst this is vBulletin's code (although it is near identical to code readily available 'out there' for mobile detection), I modified it ever so slightly to use the options from my add-on for Mobile Style and iPod Style - so enable detection of these and configure which style to disaply accordingly. When using this code, other options (such as override (which is on by default with teh above code), custom agents, etc ) are ignored.

Test and let us know how it goes. Don't try this if you're on vb4.1.2 or higher, it's already there. This is just put here as a test and is incomplete.


All times are GMT. The time now is 11:10 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.01555 seconds
  • Memory Usage 1,806KB
  • 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
  • (1)bbcode_php_printable
  • (4)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)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