Exclude Mobile theme from iPads

Permalink 2 users found helpful
When applying a mobile theme in the dashboard it seems to change it for tablets as well as mobile.

I have seen a few posts about this, and there seemed to be a fix for previous versions of Concrete5 (up to 5.6.1 i think) but this doesn't work for the latest version. (http://www.concrete5.org/community/forums/usage/mobile-theme-switcher-ipad/)

You can go into libraries/3rdparty/mobile_detect.php and exclude tablets
// $this->tabletDevices,
and this then seems to work ok (tested on a kindle fire), BUT.. on the iPad it still display's the mobile theme?

I did try commenting out any reference to iPad in the mobile_detect.php file but this still had no effect?

Does anyone have a definitive answer to getting the mobile theme to exclude ipads, without having to revert to redirecting to a different site.

It seems like there are a few people out there without responsive sites, or people that want to display a cut down version of their sites, but need it to show the desktop version on ipads and tablets.

Any help anyone can give would be much appreciated.

 
webtodesigns replied on at Permalink Reply
webtodesigns
Been having trouble with this for the last few days.

Just had a breakthrough, but not sure if it 100% working (do not have all all the devices to test).

in mobile_detect.php

From line 392 change this :

public function setMobileDetectionRules(){
        // Merge all rules together.
        $this->mobileDetectionRules = array_merge(
            $this->phoneDevices,
            $this->tabletDevices,
            $this->operatingSystems,
            $this->userAgents
        );
    }

public function setMobileDetectionRules(){
        // Merge all rules together.
        $this->mobileDetectionRules = array_merge(
            $this->phoneDevices
            //$this->tabletDevices,
            //$this->operatingSystems,
            //$this->userAgents
        );
    }


I have galaxy s3 which is showing the mobile website and galaxy tab 3 which is showing the desktop version. would be cool to know if it is working on apple devices.

Again, not sure if this 100% full proof.
*EDIT* just to note this is for conc5 5.6.2.1
-Garen
jjcdesign replied on at Permalink Reply
Thanks for your reply. Your right it has been a frustrating problem.

I have managed to do something similar to what your suggesting, I just hadn't got around to posting my findings.

What I did was comment out some lines like you have, as follows:

lines 396 & 417
//$this->tabletDevices,


line 212
//'Safari'          => 'Version.*Mobile.*Safari|Safari.*Mobile',


line 187
// 'iOS'               => '\biPhone.*Mobile|\biPod|\biPad',


This seemed to work for me, but like you can't test it over multiple devices but seems OK on iPads, Kindles, and HTC.


Unfortunately, this doesn't resolve the issue of it displaying the wrong theme if full page caching is switched on. Don't know if there is a way of forcing it to load the page (not the cached version) if visiting from a mobile device?
guyDesign replied on at Permalink Reply
In concrete/core/libraries/view.php
line 574 (in checkMobileView function )

change: if ($md->isMobile())
to: if ($md->isMobile() && !$md->isTablet())
studio4graphics replied on at Permalink Reply
In the view I have (5.6.3.1) is the following code:

So I can't change your suggested code. I excluded some code stated in the posts above and it works.

<?php
defined('C5_EXECUTE') or die("Access Denied.");
class View extends Concrete5_Library_View {}