the correct theme change is:
global $custom_theme;
$custom_theme = $mytheme;
and the whole init hook should be like:
function theme_setter_init() {
$theme_default = variable_get('theme_default', 'garland');
if ($content_type = _check_nodeform_rule()) {
if (_theme_setter_rule($content_type) ) {
global $custom_theme;
$custom_theme = $theme_default;
}
}
}
do not change the theme on pages you don't want to control, let other modules override the theme if they want..
note: the "Use administration theme for content editing" checkbox on admin/settings/admin page should be enabled for correct functionality, and you do not need to care about that in your module..
Comments
Comment #1
Stalski commentedI updated the module to these changes. I though my first tests included these things, appearently not.
@Pasqualle : Thx for your reply and testing.
The thing about 'Use administration theme for content editing', i have given it some thought before as well.
After trying out your changes, for some reason it was screwed up. I checked the content-types and roles and no result. Thinking at your remark about your note, i 'guessed' that was the problem. Indeed it was, after unsetting the 'Use administration theme for content editing' option, everything worked as I intended again.
Conclusion is simple: I knew the checkbox had to be set OFF there, so others won't know that. However, your reason is well argumented and I agree to that as well. The sollution in my opinion is to show this box on my settings page also and explain to users that activating the option 'Use administration theme for content editing' will disable most features of the theme_setter.
At least now they can choose what they want to do.
Stalski
Comment #2
Anonymous (not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.