Hi!
As part of a mobile theme I have some logic in plugin form that determines whether a user comes from a mobile device and then shows the mobile theme (instead of the desktop version).
Hook location is style_fetch. When I enable guest full page caching, this logic no longer works. Which hook location do I place this plugin code in so that it triggers before the page cache?
Thanks!
As part of a mobile theme I have some logic in plugin form that determines whether a user comes from a mobile device and then shows the mobile theme (instead of the desktop version).
Code:
if (!$vbulletin->options['forumops_mobile_groups'] or
is_member_of($vbulletin->userinfo, explode(',', $vbulletin->options['forumops_mobile_groups']))
) {
if ($show['forumops_mobile'] !== true) {
if (reset(explode('.', str_replace('www.', '', $_SERVER['SERVER_NAME']))) == 'm') {
$show['forumops_mobile'] = true;
}
/**
* @link http://stackoverflow.com/questions/6636306/mobile-browser-detection/6643934#6643934
*/
if ($show['mobile_device'] = preg_match(
'#\b(ip(hone|od)|android\b.+\bmobile|opera m(ob|in)i|windows (phone|ce)|blackberry'.
'|s(ymbian|eries60|amsung)|p(alm|rofile/midp|laystation portable)|nokia|fennec|htc[\-_]'.
'|up\.browser|[1-4][0-9]{2}x[1-4][0-9]{2})\b#i',
$_SERVER['HTTP_USER_AGENT']
)) {
$show['forumops_mobile'] = true;
}
$forceDesktop = !empty($_GET['forceDesktop']) || !empty($_COOKIE['tpf-bypass']);
if ($forceDesktop) {
$show['forumops_mobile'] = false;
}
$forceMobile = !empty($_GET['forceMobile']) || !empty($_COOKIE['tpf-mobile']);
if ($forceMobile) {
$show['forumops_mobile'] = true;
}
}
if ($show['forumops_mobile']) {
$styleid = $vbulletin->options['forumops_mobile_styleid'];
$userselect = true;
}
}
if ($show['forumops_mobile'] !== true) {
$show['forumops_mobile'] = false;
}
Hook location is style_fetch. When I enable guest full page caching, this logic no longer works. Which hook location do I place this plugin code in so that it triggers before the page cache?
Thanks!