I tried using the 6.x beta version of this module and there's an issue in the hook_boot() that will prevent this module from doing what it's supposed to do - that is, to switch to a mobile theme on a mobile device. I looked at the 7.x version and this issue looks partially fixed.

I'm seeing two issues:
1) When a mobile device is detected, we're setting "theme_default" to "mobile_switch_theme_default". This is incorrect. It should be set to "mobile_switch_theme_mobile". Looks like this is fixed in 7.x.

2) Browscap returns a string for 'ismobiledevice', not a boolean. The check for "(bool) $get['browser']['ismobiledevice'] === TRUE" will be TRUE even if $get['browser']['ismobiledevice'] is equal to 'false' as a string, because then you run it through the bool function. ((bool) "false") will equal TRUE. In general, there seems to be an overuse of the bool() function. I've decided to fix this by keeping the 'ismobiledevice' value as a string -- so when you check for the emulator, I've set that value to 'false' or 'true' as a string also. The way it was written, 'ismobiledevice' would have been 0 or 1 if working with an emulator, and 'false' or 'true' if working with an actual mobile device.

Patch will be attached.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

djbobbydrake’s picture

Patch attached.

djbobbydrake’s picture

Status: Active » Needs review

Requesting review for the patch.

djbobbydrake’s picture

Modified the patch in comment #1 to remove the unnecessary changes to the .info file.

jorlowski’s picture

Patch applied from #3. Still a no-go. Tested on iPhone.

djbobbydrake’s picture

@jorlowski If you view your site on Firefox using the User Agent Switcher Add-on to spoof an iPhone, do you get your mobile theme? This has been working for us., via emulator, user agent spoofing, as well as on iPhone and Android. Can you see what your values are for $conf['mobile_switch_theme_default'], $conf['mobile_switch_theme_mobile'], and $conf['theme_default'] on the page that's supposed to see the mobile theme?

jorlowski’s picture

Viewing the site in Firefox using the User Agent Switcher Add-on spoof I still get the desktop theme "Garland" (I'm only using this theme for testing). As of now I am using "Bluemarine" as the mobile theme for testing purposes only. I've tested on both iPhone and HTC EVO 3D handsets and both default to the desktop version.

I do get the mobile theme (Bluemarine) when I select "yes" under Desktop browser in the Development menu. This was only for a test to see if anything was actually working.

Also, I am not a noob but not a developer. Can you direct me via file name to where I'll be able to find $conf['mobile_switch_theme_default'], $conf['mobile_switch_theme_mobile'], and $conf['theme_default']?

darktiger’s picture

patch #3 does not work also on Samsung S3 neither with google browser, firefox nor opera mobile.

webadpro’s picture

Looking at the following issue might help: http://drupal.org/node/1804572

quiptime’s picture

Please test your theme switch problem with 6.x-1.x-dev.
Give me feedback.
Coming soon release 6.x-1.0-beta2 which contains the latest changes from dev.

dshields’s picture

Any progress on this?
i can't get this module to work on my drupal 6 site, testing with iPhone4

stoogiebuncho’s picture

Using the 6.x-1.x-dev version of the module seems to fix the problem for me.