Question Correct hook location before vboptimise is run ?

Status
Not open for further replies.

semprot

Customer
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
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:
vB Optimise's code also runs on that location - I'd recommend editing the vBO plugin with that code or set vBO's plugin to execution order 2.
 
Status
Not open for further replies.

Legacy vB Optimise

vBulletin 3.8.x vBulletin 4.x.x
Seller
DragonByte Technologies
Release date
Last update
Total downloads
1,980
Customer rating
0.00 star(s) 0 ratings
Back
Top