The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
||||
|
||||
Mobile login conditional?
Is there a conditon for checking to see if a login is done via Mobile device?
|
#2
|
||||
|
||||
You mean a template conditional? What do you want to use it for?
-Nick, SEOvB Developer |
#3
|
||||
|
||||
Yes, a template conditional. I want to use it to not use the IP they are loggedin with if they are on a mobile.
|
#4
|
||||
|
||||
AFAIK, there is no such conditional by default. The closest thing you could maybe access in a template is the useragent (e.g. Mozilla Firefox) with user.useragent, depending on which template you're dealing with, but that would be an awful mess of code.
If you just want to display different templates based on whether or not the user is on a mobile device, just edit the "Default Mobile Device" theme, editable from the Settings->Style & Language Settings AdminCP panel. -Nick, SEOvB Developer |
#5
|
||||
|
||||
How does vb know to display the mobile style if a mobile logs in?
Actually, what I need is the PHP conditional, not the template. |
#6
|
||||
|
||||
Hmmm... no idea. That feature is relatively new, and I haven't worked with it yet. It's probably PHP based, but that's not much help. If you're comfortable digging through code, you could check the code surrounding the init_start, global_start, and parse_template hooks.
Also, try asking over in the programming discussion forum. That would probably be a more appropriate forum for your question. -Nick, SEOvB Developer |
#8
|
||||
|
||||
Default Style for Old Mobile Browsers
Select the default mobile style for old mobile browsers. This style will be used if user is browsing your forum with an older mobile browser. Set to 'None' to use desktop browser style. Default Style for Modern Mobile Browsers Select the default mobile style for modern mobile browsers. This style will be used if user is browsing your forum with a modern mobile browser. Set to 'None' to use desktop browser style. you have this option in admincp |
#9
|
||||
|
||||
That still doesn't explain how they are selected on login.
|
#10
|
|||
|
|||
There was some merit in checking around init_start.
Code:
// Test mobile browser $mobile_browser = false; $mobile_browser_advanced = false; if ($vbulletin->options['mobilestyleid_advanced'] OR $vbulletin->options['mobilestyleid_basic']) { if (stripos($_SERVER['HTTP_USER_AGENT'], 'windows') === false OR preg_match('/(Windows Phone OS)/i', strtolower($_SERVER['HTTP_USER_AGENT']))) { if ( preg_match('/(up.browser|up.link|mmp|symbian|smartphone|midp|wap|phone|android|Windows Phone OS)/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. else if (in_array( strtolower(substr($_SERVER['HTTP_USER_AGENT'], 0, 4)), 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(strtolower(substr($_SERVER['HTTP_USER_AGENT'], 0, 4)) == 'oper' AND preg_match('/(linux|mac)/i', $_SERVER['HTTP_USER_AGENT'])) { $mobile_browser = false; } } } if ( $mobile_browser AND preg_match('/(ipad|ipod|iphone|blackberry|android|pre\/|palm os|palm|hiptop|avantgo|plucker|xiino|blazer|elaine|Windows Phone OS)/i', strtolower($_SERVER['HTTP_USER_AGENT'])) ) { $mobile_browser_advanced = true; } } |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|