I want to make my own mobile device detection code to work with vboptimise's full guest caching.
I want my code to run before any of vboptimise code is executed (to prevent full guest caching).
Here is my code
And i use this library for mobile detection.
The problem is it sometimes fails (the mobile style is not assigned by url redirection code).
I put the code on "global_bootstrap_complete" with priority "1".
Do i put the code on the correct hook location?
Thanks.
I want my code to run before any of vboptimise code is executed (to prevent full guest caching).
Here is my code
PHP:
require_once(DIR.'/mobile_detect.php');
$mobile_style_id = 4;
$detect = new Mobile_Detect();
if (isset($_GET['x_mobile_test'])) {
var_dump($detect->isMobile(), $mobile_style_id, $_COOKIE[COOKIE_PREFIX . 'userstyleid']);
}
if ($detect->isMobile() && $mobile_style_id != $_COOKIE[COOKIE_PREFIX . 'userstyleid']) {
header('Location: http://'.$_SERVER['SERVER_NAME'].'/forum.php?styleid='.$mobile_style_id.'&hook=1');
exit();
}
And i use this library for mobile detection.
The problem is it sometimes fails (the mobile style is not assigned by url redirection code).
I put the code on "global_bootstrap_complete" with priority "1".
Do i put the code on the correct hook location?
Thanks.
Last edited: