Administration Theme not working when theme selected for virtual site
| Project: | Virtual Sites |
| Version: | 6.x-1.3 |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | needs review |
Jump to:
Using Drupal 6.9, Virtual Sites 1.3
I created a custom, Zen-derived theme. I have 3 virtual sites set up, switching based on the Drupal/Sites/sitex.mysite.local condition. The switching is working properly.
I am able to specify different themes for each site and that functionality is working correctly. What is not working is the Administration Theme as set at http://sitex.mysite.local/admin/settings/admin. I'm just trying to keep Garland for my admin entry point and it seems to get overridden by my site-specific theme.
I can set up an Administrative "virtual site" so that I can keep Garland as the theme, but I would love to get any input you might have on where the theme gets overridden in the Virtual Sites module and how we can tweak it so that it allows the Administration Theme setting to be applied correctly.
Thanks much!
Craig

#1
Set up a workaround.
function _needs_admin_theme() {
$admin_theme_disallow = FALSE;
$admin_theme = FALSE;
// check if some paths are disallow to get the theme
if (trim(variable_get('admin_theme_path_disallow', '')) != '') {
// pages that are defined by their normal path
$admin_theme_disallow = drupal_match_path($_GET['q'], variable_get('admin_theme_path_disallow', ''));
// pages that are defined with their alias
$alias = drupal_get_path_alias($_GET['q']);
if ($alias != $_GET['q']) {
$admin_theme_disallow = $admin_theme || drupal_match_path($alias, variable_get('admin_theme_path_disallow', ''));
}
}
// we should not show the admin theme if the user has no access or the path is in the disallow list
if (!user_access('access admin theme') || $admin_theme_disallow) {
global $custom_theme;
$custom_theme = '0';
return;
}
$admin_theme = (arg(0) == 'admin' || (variable_get('node_admin_theme', '0') && arg(0) == 'node' && (arg(1) == 'add' || arg(2) == 'edit')));
// check if an option is enabled and if it results to TRUE
$list = admin_theme_list();
foreach ($list as $info) {
$var = admin_theme_variable_name($info['module'], $info['option']);
if ((bool)variable_get($var, '0') && module_invoke($info['module'], 'admin_theme', 'check', $info['option'])) {
$admin_theme = TRUE;
}
}
// some custom defined pages should get admin theme
if (trim(variable_get('admin_theme_path', '')) != '') {
// pages that are defined by their normal path
$admin_theme = $admin_theme || drupal_match_path($_GET['q'], variable_get('admin_theme_path', ''));
// pages that are defined with their alias
$alias = drupal_get_path_alias($_GET['q']);
if ($alias != $_GET['q']) {
$admin_theme = $admin_theme || drupal_match_path($alias, variable_get('admin_theme_path', ''));
}
}
// Use the admin theme for the current request (if global admin theme setting is checked).
return $admin_theme;
}
if (($context['theme']) && (!_needs_admin_theme())) {I know this is a bit of a hack, but it accomplishes what I need for the time being.
#2
My solution is:
1) Go to admin/build/sites
2) Don't use 'Theme' feature (set to 'skip this feature') for every virtual site
3) Use 'Variable' feature for every virtual site:
theme_default=zen_subtheme
admin_theme=garland
(zen_subtheme is the name of your default theme and garland is the name of your admin theme)
I've also change weight of module 'Virtual Sites' to -1 in {system} table.