Status
Not open for further replies.

semprot

Customer
I use Dartho's lightweight style, popular vbulletin mobile skin.
In addition, since vb 4.x (i think 4.1), i install this plugin too
VB4 - Mobile Phone / iPhone / PDA Detection and Style Assignment

It allows visitors to get mobile style automotically when the board is visited by mobile device.
But to allow that plugin to works, dartho's style must be imported as non-mobile style.

Now enabling guest full cache sometimes serves a guests with mobile style, sometimes not.
So it seems the cache between desktop-user guests, and mobile-user guests are mixed up.

Can you help me how to make guest caching working with that mod?
I've tried several way such as modifying that mod to redirect mobile users to "forum.php?styleid=xxx" but it seems the vboptimise caching hook (hook : "(Pro) Start Guest Caching / CDN Startup", global_bootstrap_complete, execution order has been changed by me to 2) is executed before that plugin's hook (hook : style_fetch, execution order : 1)

Here is the style assignment code (which has been modified a bit by me)
PHP:
global $forum_dartho;
$forum_dartho = 0;
$ciao=0;

if (($_GET['styleid']) && ($vbulletin->options['mob_detect_override']==1) && ($vbulletin->options['mob_detect_enabled'] == 1)) {
    setcookie("override","on");
    $styleid=intval($_GET['styleid']);
    $ciao=1;
}

if (($_COOKIE["override"]=="on") && ($vbulletin->options['mob_detect_override']==1) && ($vbulletin->options['mob_detect_enabled'] == 1)) {
    $ciao=1;
}


if (($vbulletin->options['mob_detect_enabled'] == 1) && ($ciao==0))
  {
  setcookie ("override", "", time() - 3600);
  $mobile=0;
  $pda=0;
  $ipod=0;
  $except_browser=0;
  $custom1=0;

  if ($vbulletin->options['brows_exceptions_enabled'] == 1)
  {
  $exceptbrowsers = explode(",",$vbulletin->options['brows_exceptions']);
  if(preg_match('/('.implode('|', $exceptbrowsers).')/i', $_SERVER['HTTP_USER_AGENT'], $match))
    {
        $except_browser=1;
    }
  }



  if ($except_browser==0)
  {
    if ($vbulletin->options['custom1_skin_enabled'] == 1)
    {
    $custom1agents = explode(",",$vbulletin->options['custom1_skin_agent']);
    if(preg_match('/('.implode('|', $custom1agents).')/i', $_SERVER['HTTP_USER_AGENT'], $match))
      {
          $custom1=1;
      }
    }

    if ($vbulletin->options['pda_skin_enabled'] == 1 && $custom1==0) 
    {
      $pdabrowsers = array(
          "Windows CE"
          );
    if(preg_match('/('.implode('|', $pdabrowsers).')/i', $_SERVER['HTTP_USER_AGENT'], $match))
      {
        $pda=1;
      }
      else if (isset($_SERVER['HTTP_UA_OS']))
      {
      if (strstr($_SERVER['HTTP_UA_OS'],"POCKET PC") !== false)
        {
	  $pda=1;
        }
      }
    }

    if ($vbulletin->options['ipod_skin_enabled'] == 1 && $custom1==0) 
    {
      $ipodbrowsers = array(
          "iPod",
          "iPhone"
          );
      if(preg_match('/('.implode('|', $ipodbrowsers).')/i', $_SERVER['HTTP_USER_AGENT'], $match))
      {
        $ipod=1;
      }
    }


    if ($pda == 0 && $ipod ==0 && $custom1==0)
    {
      if ($vbulletin->options['mobile_skin_enabled'] == 1) 
      {
      $mobilebrowsers = array(
        "WebTV",
        "AvantGo",
        "Blazer",
        "PalmOS",
        "lynx",
        "Go.Web",
        "Elaine",
        "ProxiNet",
        "ChaiFarer",
        "Digital Paths",
        "UP.Browser",
        "Mazingo",
        "iPhone",
        "iPod",
        "Mobile",
        "T68",
        "Syncalot",
        "Danger",
        "Symbian",
        "Symbian OS",
        "SymbianOS",
        "Maemo",
        "Nokia",
        "Xiino",
        "AU-MIC",
        "EPOC",
        "Wireless",
        "Handheld",
        "Smartphone",
        "SAMSUNG",
        "J2ME",
        "MIDP",
        "MIDP-2.0",
        "320x240",
        "240x320",
        "Blackberry8700",
        "Opera Mini",
        "NetFront",
        "BlackBerry",
        "PSP"
        );
 
        if(preg_match('/('.implode('|', $mobilebrowsers).')/i', $_SERVER['HTTP_USER_AGENT'], $match))
        {
          $mobile=1;

        }
        elseif (strpos($_SERVER['HTTP_ACCEPT'], 'application/vnd.wap.xhtml+xml'))
        {
          $mobile=1;
        }
        elseif (strpos($_SERVER['HTTP_ACCEPT'], 'text/vnd.wap.wml'))
        {
          $mobile=1;
        }
      }
    }
  }

  if ($mobile==1)
  {
    //      echo "<!-- Mobile Device -->";
    $styleid=$vbulletin->options['mobile_skin'];
	$forum_dartho = $styleid;
	//header('Location: http://'.$_SERVER['SERVER_NAME'].'/forum.php?styleid='.$styleid.'&lets_go=1');
	//exit();
  }
  else if ($pda==1)
  {
    //      echo "<!-- PDA Device -->";
    $styleid=$vbulletin->options['pda_skin'];
	$forum_dartho = $styleid;
	//header('Location: http://'.$_SERVER['SERVER_NAME'].'/forum.php?styleid='.$styleid.'&lets_go=1');
	//exit();
  }
  else if ($ipod==1)
  {
    //      echo "<!-- IPOD Device -->";
    $styleid=$vbulletin->options['ipod_skin'];
	$forum_dartho = $styleid;
	//header('Location: http://'.$_SERVER['SERVER_NAME'].'/forum.php?styleid='.$styleid.'&lets_go=1');
	//exit();
  }
  else if ($custom1==1)
  {
    //      echo "<!-- CUSTOM1 Device -->";
    $styleid=$vbulletin->options['custom1_skin'];
	$forum_dartho = $styleid;
	//header('Location: http://'.$_SERVER['SERVER_NAME'].'/forum.php?styleid='.$styleid.'&lets_go=1');
	//exit();
  }
  else if ($except_browser==1)
  {
    //      echo "<!-- Excepted Device -->";
  }
  else
  {
    //      echo "<!-- No Mobile Device-->";
  }
}
unset ($ciao);

Thanks.
 
Last edited:
I don't believe this can be resolved. The mod you're quoting explicitly needs to run the first time styles are fetched, which only happens the first time a template is requested, which again happens later than vBO runs.
 
I don't believe this can be resolved. The mod you're quoting explicitly needs to run the first time styles are fetched, which only happens the first time a template is requested, which again happens later than vBO runs.
So that mod actually runs after vbo runs?
 
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,972
Customer rating
0.00 star(s) 0 ratings
Back
Top