Cannot redeclare phptemplate_body_class()
| Project: | Role Theme Switcher |
| Version: | 5.x-1.2 |
| Component: | Code |
| Category: | bug report |
| Priority: | critical |
| Assigned: | Unassigned |
| Status: | closed |
Jump to:
I'm using the latest version of your module and I get this error:
Fatal error: Cannot redeclare phptemplate_body_class() (previously declared in /usr/home/stealth17/www/stage.mpj.com/themes/promo/template.php:7) in /usr/home/stealth17/www/stage.mpj.com/themes/agency/template.php on line 23
I have been using the module without issues for a while now and somehow when I made some changes to my themes I now get the error. I checked through everything I changed and cannot find any possible cause. I have two themes, both based on phptemplate. All roles use the default theme except one, and when I login with that role that uses a different theme I get the error. I tried changing the module weight so the theme was changed before any other hooks ran, no luck. Any ideas?
Thanks!

#1
Found the problem. It was actually a conflict with the JSV module. JSV was adding some settings to the theme and since Role Theme Switcher hadn't been called yet it was calling the wrong theme. Then after RTS ran, it would try to call the proper theme but the default theme had already been included therefore causing a conflict.
I will submit a patch tonight, it's actually a fix in both this module and the JSV module. Basically all I did was move the role_theme_switcher_mainfunc() to hook_init() so it will be called right out of the gates.
<?php/**
* Implementation of hook_init()
*
* MUST switch theme on init so other modules calling the theme
* don't load the wrong theme.
*/
function role_theme_switcher_init() {
role_theme_switcher_mainfunc();
}
?>
#2
Please use 5.x-2.0
This issue is fixed in this version
#3
Automatically closed -- issue fixed for two weeks with no activity.