If you use full page guest caching feature from vb optimise, you might need this plugin (or not).
When you use dartho's mobile lightweight style (like me), you might need this plugin.
If you do not use full page guest caching, you do not need this plugin.
This plugin will properly (at least in my board) redirect mobile guests to the mobile style, before vb optimise starts to cache mobile guests views.
First you can save this php file to your forum root (or any path it is fine), you can save it as "mobile_detect.php"
https://raw.github.com/serbanghita/Mobile-Detect/master/Mobile_Detect.php
Next, go to admincp > add new plugin
Hook Location : global_bootstrap_complete
Title : anything you want
Execution order : 0
PHP Code :
Next, hit save. Everything should work properly now
Note: maybe dbt staff can sticky this thread for other dbt customers
When you use dartho's mobile lightweight style (like me), you might need this plugin.
If you do not use full page guest caching, you do not need this plugin.
This plugin will properly (at least in my board) redirect mobile guests to the mobile style, before vb optimise starts to cache mobile guests views.
First you can save this php file to your forum root (or any path it is fine), you can save it as "mobile_detect.php"
https://raw.github.com/serbanghita/Mobile-Detect/master/Mobile_Detect.php
Next, go to admincp > add new plugin
Hook Location : global_bootstrap_complete
Title : anything you want
Execution order : 0
PHP Code :
PHP:
require_once(DIR.'/x_kitchen/mobile_detect.php');
$mobile_style_id = 4;
$detect = new Mobile_Detect();
if ($detect->isMobile()) {
$user_style_id = 0;
if (defined('STYLE_ID')) {
$user_style_id = STYLE_ID;
}
$cookie_prefix = '';
if (defined('COOKIE_PREFIX')) {
$cookie_prefix = COOKIE_PREFIX;
}
$_style_cookie = false;
if (isset($_COOKIE[$cookie_prefix . 'userstyleid'])) {
$_style_cookie = intval($_COOKIE[$cookie_prefix . 'userstyleid']);
}
if (isset($_GET['styleid'])) {
$user_style_id = intval($_GET['styleid']);
} else if (false !== $_style_cookie) {
$user_style_id = $_style_cookie;
}
if (isset($_GET['x_mob_test'])) {
var_dump($detect->isMobile(), $mobile_style_id, $user_style_id, $_style_cookie);
}
$redirect = false;
if (false === $_style_cookie) {
$redirect = true;
} else if ($mobile_style_id != $user_style_id) {
$redirect = true;
}
if (isset($_GET['x_mob_test'])) {
var_dump($detect->isMobile(), $redirect, $mobile_style_id, $user_style_id, $_style_cookie);
}
if ($redirect) {
header('Location: http://'.$_SERVER['SERVER_NAME'].'/forum.php?styleid='.$mobile_style_id.'&hook=1');
exit();
}
}
Next, hit save. Everything should work properly now
Note: maybe dbt staff can sticky this thread for other dbt customers
Last edited: