The administration theme is not being active at all when i use the module.
I use 3 themes:
1- admin theme
2- website theme
3- mobile theme

the admin theme (admin pages) does not take any effect at all when using the module.

Comments

ball.in.th’s picture

It seems mobileplugin overrides the admin theme variable. From looking at the code in Mobile Tools module, the theme can be changed by setting the global $conf['theme_default'] in hook_init() too.

Also, many other variables can also be changed in hook_init(), for example, 'site_name', 'site_slogan', 'default_nodes_main', 'page_title_front', 'page_title_default'.

kgthompson’s picture

I globaled $user on hook_init and updated the following code:

if (!user_access(MOBILEPLUGIN_ENABLE) || $user->uid == 1) {
return;
}

Works for admin.

ianchan’s picture

subscribe

Dr.Theopolis’s picture

Component: Miscellaneous » Code

The change suggested above appears to cause all images to get scaled no matter what when logged in as uid 1. Perhaps a better change would be to check for uid 1 in function _mobileplugin_set_theme(). Here's what I did and it fixed both problems for me:

function _mobileplugin_set_theme() {
global $mobileplugin_group, $custom_theme, $user;
if (($group != MOBILEPLUGIN_FULL_GROUP) && ($user->uid != 1)) {
$grouplist = _mobileplugin_get_groups();
$custom_theme = $grouplist[$mobileplugin_group]['theme'];
}
}

tallsimon’s picture

Title: administrator theme not takin effect » mobileplugin overrides the admin theme variable

anyone up for making a patch or putting in dev to try out?

I hacked the module code too and it worked for me :-)

bkat’s picture

The change in #4 means that the superuser will never use the mobile theme.

The real problem is that the variable that is globaled is called mobileplugin_group but the if test is using $group

The function should be

function _mobileplugin_set_theme() {
global $mobileplugin_group, $custom_theme, $user;

if ($mobileplugin_group != MOBILEPLUGIN_FULL_GROUP ) {
$grouplist = _mobileplugin_get_groups();
$custom_theme = $grouplist[$mobileplugin_group]['theme'];
}
}

nrackleff’s picture

subscribe

alfthecat’s picture

subscribing (2.x)

icampana’s picture

Priority: Normal » Major
Issue tags: +typo

The error is located in line 220 on the file mobileplugin.module, it is using a completely wrong variable name, now it looks like this:

if ($group != MOBILEPLUGIN_FULL_GROUP) {

But it really should be:
if ($mobileplugin_group != MOBILEPLUGIN_FULL_GROUP) {

The $group variable doesn't even exists, it is a typo, but could cause a lot of troubles especially if you rely somehow on the administration template. By using this change, it doesn't replace the template, unless it is a detected device belonging to a specific group.

That solves completely the problem.

bkat’s picture

Is this any different than what I posted in #6?

drupalninja99’s picture

Version: 6.x-1.1 » 6.x-2.0

+1 on the $mobileplugin_group group fix in #9. That is an obvious bug and fixes the issue. This is still happening in 2.0

robin_b’s picture

Fix in #9 works. Clear browser session data afterwards to see the changes take effect.

HS’s picture

Has this been fixed in the latest version or is a hack still necessary?