I've activated the Anonymous user (mobile) role, but apparently it doesn't get used if I access the page from a mobile phone. Instead, the permissions of a regular anonymous user are applied.

That's probably tied to this error that gets thrown when I want to activate the Anonymous user (mobile) role:
Call to undefined function db_last_insert_id() in /var/www/drupal/modules/mobile_tools/mobile_tools.module on line 973, referer: http://server.com/drupal/?q=en/admin/settings/mobile-tools/roles
PHP version is 5.2.10

Ist there a way to either fix this or use another way to display a customized front page for users of the mobile theme?

Comments

znero’s picture

Category: bug » support
znero’s picture

I just wanted to mention again that I still experience that error. Any idea on how to fix it?

chris.toler’s picture

Version: 5.x-1.x-dev » 6.x-1.9

I'm having this issue with 6.x-1.9, without the error mentioned above. Activating the anonymous role seems to work, and I attempt to remove "node access" as a permission for it, but the mobile site continues to use the normal anonymous permissions.

jarchowk’s picture

Take a look at your mobile_tools_roles.inc .. in the _boot and _user function there is a condition that looks like:

      if ($role->type == 'desktop' && $role->has_sibling == 1 && ($_SESSION['mobile-tools-site-type'] == 'mobile' || ($_SESSION['mobile-tools-mobile-device']['type'] == 'mobile' && variable_get('mobile-tools-theme-switch', FALSE) == 'mobile-tools-mobile-device'))) {

and

      if ($role->type == 'desktop' && $role->has_sibling == 1 && $_SESSION['mobile-tools-site-type'] == 'mobile') {

respectively. I replaced both with:

      if ($role->type == 'desktop' && $role->has_sibling == 1 && mobile_tools_is_mobile_site() == 'mobile') {

and the roles seem to be switching fine now. I am guessing those session vars were deprecated and the roles include wasn't updated? Please let me know if you can see any problems with this fix.

twom’s picture

Assigned: Unassigned » twom
Status: Active » Needs review

Thx for the fix. In meantime I gave the mobile roles code a good update that should fix a number of errors.
It is ready to review in the dev version.

rlustemberg’s picture

I've created 2 views with access restrictions based on the mobile and normal roles. One view displays content in a grid of 2 elements, the other in a grid of 4.

I've tried the latest dev version and I found it applies permissions from the 'anonymous' role to the 'anonymous (Mobile)' role. It has no problems telling between authenticated and 'authenticated (Mobile).

I am in a hurry now, so I'll use a workaround of setting up a new menu with different items specifically for the Mobile theme, using theming hacks, but later this week I'll have a closer look to see what is happening.

minoroffense’s picture

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

Has this been fixed in a newer release?

akosipax’s picture

I have the same problem too. I have 2 views with the same path, one can be accessed by anonymous and the other by anonymous (mobile). When I check the page in a mobile phone, the view which is for (regular) anonymous users show. The view for anonymous (mobile) isn't applied.

I temporarily changed the first view to authenticated just to check if views isn't the problem. It worked. When I go to my desktop page as anonymous, I can't access it. And when I go to the same page using my mobile phone, I now see the view for anonymous (mobile).

It seems like whatever is applied to the anonymous role, is also applied to anonymous (mobile)!

minoroffense’s picture

Just to clarify, is this issue with 6.x-1.9 or is it an old ticket?

If it is with 1.9, can you check if the bug exists in 2.x as well?

Thanks

akosipax’s picture

Version: 6.x-1.9 » 6.x-2.3

Yes, it exists in 6.x-2.3. That's the version I use.

alfthecat’s picture

have this problem too, but the solution from #4 can't be applied to version 2.x (dev) as the file mobile_tools_roles.inc does no longer exist. I can't find the referenced code anywhere.

My problem is that for some reason, mobile users are only partly detected. I tried excluding certain content types through the content_access module by restricting them to non-mobile roles. That doesn't work, although in the forum_access module, it does work.

Rules based on mobile roles won't trigger. But in Panles, I can issue redirects based on device detection.

This has me severely puzzled....