Closed (fixed)
Project:
Mobile Tools
Version:
6.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Reporter:
Created:
12 May 2009 at 21:47 UTC
Updated:
23 May 2009 at 19:31 UTC
Jump to comment: Most recent file
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!
| Comment | File | Size | Author |
|---|---|---|---|
| #1 | mobile_tools-460850.patch | 1.12 KB | Dave.Ingram |
Comments
Comment #1
Dave.Ingram commentedOK, 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.
Comment #2
twom commentedHi,
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?
Comment #3
twom commented