I think this is a bug.

The panel variant that I use for mobile sites is still being used even with ?nomobile=true (although the correct desktop theme *is* being used). I can add another selection rule to get around this:
return (!$_GET['nomobile']); and all works fine, the true desktop version is shown.

So, to duplicate:
1. Create a mobile theme
2. Set up mobile tools to redirect to domain.com/mobile and to use mobile theme
3. Create Home Page panels variant with selection rule "Mobile Tools" and select all devices
- make sure variant content is actually different from desktop version
4. In mobile device, visit domain.com/mobile?nomobile=true
This results, for me, in the desktop theme being used but still using the mobile Home Page variant. Adding the above referenced additional selection rule bypasses this.

If this truly is a bug, I'd be glad to look into a fix. If not, can someone tell me what I'm doing wrong?

Panels 6.x-3.3

Members fund testing for the Drupal project. Drupal Association Learn more


chrisrockwell’s picture

Component: Miscellaneous » Code

The workaround I posted above does not solve the problem. With the workaround, exiting and returning to the panel variant controlled page results in the incorrect variant displaying (because $_GET['nomobile'] no longer exists).

The fix that I have now implemented that seems to completely solve the issue is adding the following to line 57 of mobile_tools/plugins/access/is_mobile.inc

  $mobile_session = $_SESSION['mobile-tools-site-type'];
    if ($mobile_session == 'desktop') {
      return FALSE;
chrisrockwell’s picture

I'm not familiar with cvs, but I'll try to submit a patch shortly.

chrisrockwell’s picture

Status: Active » Needs review
minorOffense’s picture

Status: Needs review » Postponed (maintainer needs more info)

Is this still an issue? If so do you have a patch available?

klaasvw’s picture

Version: 6.x-1.x-dev » 6.x-2.x-dev
Status: Postponed (maintainer needs more info) » Needs review
545 bytes

This is still an issue. The ctools plugin filters by real device and doesn't take the cookie or $_GET['device'] variable into account. So that means forced switching doesn't work for the ctools access plugin.

Here's a patch against the latest 6.x dev version. It uses mobile_tools_get_device() to check the device type instead of mobile_tools_is_mobile_device()

minorOffense’s picture

Assigned: Unassigned » minorOffense

Thanks for the patch, I'll test it out and let you know. If it works I'll commit it today.

corey.aufang’s picture

I came across this error myself and made the same fix and it worked perfectly as far as I can tell.