Active
Project:
Mobile Plugin
Version:
6.x-2.0
Component:
Code
Priority:
Major
Category:
Bug report
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
28 Jul 2009 at 10:59 UTC
Updated:
12 Oct 2012 at 14:32 UTC
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
Comment #1
ball.in.th commentedIt 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'.
Comment #2
kgthompson commentedI globaled $user on hook_init and updated the following code:
if (!user_access(MOBILEPLUGIN_ENABLE) || $user->uid == 1) {
return;
}
Works for admin.
Comment #3
ianchan commentedsubscribe
Comment #4
Dr.Theopolis commentedThe 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'];
}
}
Comment #5
tallsimon commentedanyone up for making a patch or putting in dev to try out?
I hacked the module code too and it worked for me :-)
Comment #6
bkat commentedThe 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'];
}
}
Comment #7
nrackleff commentedsubscribe
Comment #8
alfthecat commentedsubscribing (2.x)
Comment #9
icampanaThe 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.
Comment #10
bkat commentedIs this any different than what I posted in #6?
Comment #11
drupalninja99 commented+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
Comment #12
robin_b commentedFix in #9 works. Clear browser session data afterwards to see the changes take effect.
Comment #13
HS commentedHas this been fixed in the latest version or is a hack still necessary?