Hi there, I'm just getting started with this module and it's just what I was looking for. I'm using the mobile roles feature though, and have discovered that when logged in on my desktop, I'm getting the mobile role of both anonymous and authenticated instead of getting the normal role. When logging in on my iPhone I also get the mobile role, so there's never a time when I don't have the mobile role if I have that feature enabled.

This is conflicting with some logic that I'm trying to do on the site, so hoping that you can give me some direction on this. Thanks!

CommentFileSizeAuthor
#1 mobile_tools-460850.patch1.12 KBDave.Ingram

Comments

Dave.Ingram’s picture

StatusFileSize
new1.12 KB

OK, well I did some more digging and it looks like the bug was in the mobile_tools_roles_init function. It was not checking if the site was actually mobile before reassigning the user's roles. I added a check to see if $_SESSION['mobile-tools-mobile-device']['type'] == 'mobile' before doing the unset and setting the new role, and this seems to have done the trick for my application. Here is a patch.

twom’s picture

Status: Active » Needs review

Hi,

Thx for the help. I have updated the code.
I changed your code by using

$_SESSION['mobile-tools-site-type'] == 'mobile' || ($_SESSION['mobile-tools-mobile-device']['type'] == 'mobile' && variable_get('mobile_tools_handling', FALSE) == 'theme-switch'

as a check.

The module doesn't want to display a mobile site to the user when he is accessing from a mobile device, but only when the user is viewing the mobile site (with mobile url), or if theme switching is enabled and the user accesses from a mobile device.

Does this make sence :)

Can you test it?

twom’s picture

Assigned: Unassigned » twom
Status: Needs review » Closed (fixed)