Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

Mobile not working

For some reason, Vanilla will not switch to mobile on my Blackberry Q10 or Nokia N9. However, I know it's not because of user agent, because Vanilla Community Forums loads the mobile site. Why won't my site load mobile?

Comments

  • PCunicornPCunicorn New
    edited September 2013

    Did that, no change. Vanilla version is the latest (edit by UnderDog : most likely I probably maybe have 2.0.18.8), site (temporary) is hotwheelspix.com/vanilla and the mobile theme is the stock one.

  • TamaTama United Kingdom ✭✭✭

    Just checking have you added

    $Configuration['Garden']['MobileTheme'] = 'mobile'; to your config.php

    There was an error rendering this rich post.

  • peregrineperegrine MVP
    edited September 2013

    • 1

    However, I know it's not because of user agent, because Vanilla Community Forums loads the mobile site.

    Your logic is blurry - Vanilla Community Forums (vanilla 2.3.x is a different vanilla version than your site (2.0.18.8)
    and they may have indeed modified the vanilla/library/core/functions.general.php

    Your site does load mobile for other user agents, so mobile is working! just not for the user agents you specified.
    your mobile theme is setup properly. but you need to modify core.


    • 2

    Why won't my site load mobile?

    because you need to make the changes in functions.general.php - one way to do it is indicated in the link

    http://vanillaforums.org/discussion/comment/171195/#Comment_171195

    Vanilla will not switch to mobile on my Blackberry Q10 or Nokia N9.

    modifying functions.general.php appropriately as specified in link will indeed make Vanilla switch to mobile on Blackberry Q10 or Nokia N9 devices.


    • 3

    Did that, no change.

    did what? - post exactly what you did with the code changes after you made them!


    • 4

    Vanilla version is the latest

    this tells us nothing by the way. There are several latests. for the record you can find your version # here.

    to find your vanilla version
    http://vanillaforums.org/discussion/comment/191960/#Comment_191960

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • UnderDogUnderDog MVP
    edited September 2013

    Thanks for the extra info peregrine! I added the version info to his post, so at least we know the number. presses 'patience' button for peregrine

    There was an error rendering this rich post.

  • peregrine, 1. Ok
    2. Can't find functions.general.php
    3. I did what the first post by vrijvlinder told me.
    4. Alright.

  • vrijvlindervrijvlinder Papillon-Sauvage MVP

    @PCunicorn said:
    2. Can't find functions.general.php

    That is in library/core/functions.general.php

    1. I did what the first post by vrijvlinder told me.

    You needed to read the whole thread to understand what is happening....It has everything to do with User Agent ....

    Start at line 1603 and find this code and add your device to the array.

    if (!function_exists('IsMobile')) {
       function IsMobile($Value = NULL) {
          static $IsMobile = NULL;
    
          if ($Value !== NULL)
             $IsMobile = $Value;
    
          // Short circuit so we only do this work once per pageload
          if ($IsMobile !== NULL) return $IsMobile;
    
          // Start out assuming not mobile
          $Mobile = 0;
    
          $AllHttp = strtolower(GetValue('ALL_HTTP', $_SERVER));
          $HttpAccept = strtolower(GetValue('HTTP_ACCEPT', $_SERVER));
          $UserAgent = strtolower(GetValue('HTTP_USER_AGENT', $_SERVER));
          if (preg_match('/(up.browser|up.link|mmp|symbian|smartphone|midp|wap|phone|opera m|kindle|webos|playbook|bb10)/i', $UserAgent))
             $Mobile++;
    
          if(
             (strpos($HttpAccept,'application/vnd.wap.xhtml+xml') > 0)
             || (
                (isset($_SERVER['HTTP_X_WAP_PROFILE'])
                || isset($_SERVER['HTTP_PROFILE'])))
             )
             $Mobile++;
    
          if(strpos($UserAgent,'android') > 0 && strpos($UserAgent,'mobile') > 0)
             $Mobile++;
    
          $MobileUserAgent = substr($UserAgent, 0, 4);
          $MobileUserAgents = array(
              'w3c ','acs-','alav','alca','amoi','audi','avan','benq','bird','blac',
              'blaz','brew','cell','cldc','cmd-','dang','doco','eric','hipt','inno',
              'ipaq','java','jigs','kddi','keji','leno','lg-c','lg-d','lg-g','lge-',
              'maui','maxo','midp','mits','mmef','mobi','mot-','moto','mwbp','nec-',
              'newt','noki','palm','pana','pant','phil','play','port','prox','qwap',
              'sage','sams','sany','sch-','sec-','send','seri','sgh-','shar','sie-',
              'siem','smal','smar','sony','sph-','symb','t-mo','teli','tim-','tosh',
              'tsm-','upg1','upsi','vk-v','voda','wap-','wapa','wapi','wapp','wapr',
              'webc','winw','winw','xda','xda-');
    
          if (in_array($MobileUserAgent, $MobileUserAgents))
             $Mobile++;
    
          if (strpos($AllHttp, 'operamini') > 0)
             $Mobile++;
    
          // Windows Mobile 7 contains "windows" in the useragent string, so must comment this out
          // if (strpos($UserAgent, 'windows') > 0)
          //   $Mobile = 0;
    
          $IsMobile = ($Mobile > 0);
    
          $ForceNoMobile = Gdn_CookieIdentity::GetCookiePayload('VanillaNoMobile');
          if (($Mobile > 0) && $ForceNoMobile !== FALSE && is_array($ForceNoMobile) && in_array('force', $ForceNoMobile))
             $IsMobile = NULL;
    
          return $IsMobile;
       }
    }
    
    if (!function_exists('IsSearchEngine')) {
       function IsSearchEngine() {
          $Engines = array(
             'googlebot', 
             'slurp', 
             'search.msn.com', 
             'nutch', 
             'simpy', 
             'bot', 
             'aspseek', 
             'crawler', 
             'msnbot', 
             'libwww-perl', 
             'fast', 
             'baidu', 
          );
          $HttpUserAgent = strtolower(GetValue('HTTP_USER_AGENT', $_SERVER, ''));
          if ($HttpUserAgent != '') {
             foreach ($Engines as $Engine) {
                if (strpos($HttpUserAgent, $Engine) !== FALSE)
                   return TRUE;
             }
          }
          return FALSE;
       }
    }
    

    Here is info on the blackberry user agent ID

    http://devblog.blackberry.com/2012/08/blackberry-10-user-agent-string/

    User Agent list and ID

    http://techpatterns.com/forums/about304.html

    List of user agent strings

    http://www.useragentstring.com/pages/useragentstring.php

Sign In or Register to comment.