Hi.

I have been using version 1 with no problems. After I upgraded to current 6.x-2.0-beta6, ThemeKey stopped working. All my rules I have set are not working at all, theme isn't switched. No problems or errors reported anywhere in drupal, neither in Apache log. I tried completely disable and uninstall module, clear all site caches, cleaned database manualy of all themekey entries, than I installed module again, but still no go. I tried to install ThemeKey Properties module, turned on Debug mode, but again, all is set up correctly, but theme isn't switching.

Any ideas please?

Thanks a lot.

CommentFileSizeAuthor
#6 debug_init_theme.patch412 bytesmkalkbrenner
#2 themekey_rules.gif13.26 KBlakyljuk

Comments

mkalkbrenner’s picture

Which ThemeKey 6.x-1.x version did you use exactly?
Please provide a screen shot of your current rules.

lakyljuk’s picture

StatusFileSize
new13.26 KB

Hello.

Thanks for a reply. I was using ThemeKey 6.x-1.2beta7 before, upgraded and rules stopped working. Even I did everything I wrote in previous post, I couldn't make it work. It is strange, that no errors are reported anywhere, not in drupal log, not in Apache webserver log. I disabled all ThemeKey modules, uninstalled them, deleted them, flushed all caches, removed all ThemeKey traces from database and then did clean install of latest version 2 beta, set rules again, but still nothing. Theme I would like to switch to, is functional and I can change to this theme in my user profile, so I know it is working. Screenshot attached. I set rules with help of ThemeKey Properties Debug, but it didn't helped.

Thanks for your time.

mkalkbrenner’s picture

Title: ThemeKey not working after update from version 1 » ThemeKey does not switch themes
Assigned: Unassigned » mkalkbrenner
Priority: Critical » Normal
mkalkbrenner’s picture

Status: Active » Needs review

Under some circumstances debug messages cause ThemeKey to not switch a theme.
Please update to ThemeKey 6.x-2.0-beta7 and ThemeKey Properties 6.x-2.0-beta2.
If theme switching now works ... perfect.
Otherwise turn on a new debug feature called "Trace ThemeKey rule switching" and post a screen shot of a page you expected to use a different theme.

lakyljuk’s picture

Hello.

Thanks for a new versions and quick reply. Unfortunately it isn't working for me. I have disabled, uninstalled previous versions of ThemeKey and ThemeKey Properties and installed latest beta as you suggested. Set up rules again. It had no effect, theme is not switched. Then I turned on Debug mode and displayed page which was supposed to be in different theme. Theme was not changed, but two messages from Debug mode were displayed:

* ThemeKey Debug: Match: "drupal:path = taxonomy/vocabulary/34 >>> newsflash"
* ThemeKey Debug: Switching theme to newsflash.

But as I said - theme is not switched. Is it possible, that ThemeKey is in conflict with some other module? I cannot think of any, which could cause this.

Thanks

Lukas

mkalkbrenner’s picture

StatusFileSize
new412 bytes

OK, ThemeKey itself works:
"ThemeKey Debug: Switching theme to newsflash."

I guess that another module calls init_theme() before ThemeKey sets the $custom_theme.
If you want to we can find out what happens. If you apply the attached patch to includes/theme.inc it will print some debug output just for the site administrator which you should post here.

lakyljuk’s picture

Thanks.

Applied patch and here is the output, when accessing page which should be switched theme (and is not):

#0 init_theme() called at [/data/www/1zsfm.cz/www.1zsfm.cz/includes/theme.inc:594]
#1 theme(insertFrame_init) called at [/data/www/1zsfm.cz/www.1zsfm.cz/sites/all/modules/insertFrame/insertFrame.module:20]
#2 insertFrame_init()
#3 call_user_func_array(insertFrame_init, Array ()) called at [/data/www/1zsfm.cz/www.1zsfm.cz/includes/module.inc:483]
#4 module_invoke_all(init) called at [/data/www/1zsfm.cz/www.1zsfm.cz/includes/common.inc:2612]
#5 _drupal_bootstrap_full() called at [/data/www/1zsfm.cz/www.1zsfm.cz/includes/bootstrap.inc:1078]
#6 _drupal_bootstrap(8) called at [/data/www/1zsfm.cz/www.1zsfm.cz/includes/bootstrap.inc:989]
#7 drupal_bootstrap(8) called at [/data/www/1zsfm.cz/www.1zsfm.cz/index.php:16]

* ThemeKey Debug: Match: "drupal:path = taxonomy/vocabulary/34 >>> newsflash"
* ThemeKey Debug: Switching theme to newsflash.

mkalkbrenner’s picture

Title: ThemeKey does not switch themes » insertTheme must not call theme() in hook_init()
Project: ThemeKey » insertFrame
Version: 6.x-2.0-beta6 » 6.x-2.0
Component: Miscellaneous » Code
Assigned: mkalkbrenner » Unassigned
Status: Needs review » Active

Module insertFrame causes the trouble. It calls theme('insertFrame_init') within it's implementation of hook_init().
That's not allowed in Drupal 6:
http://drupal.org/node/219910#comment-1254086

This also breaks Drupal 6 core functionality to set an administration theme.

mkalkbrenner’s picture

Title: insertTheme must not call theme() in hook_init() » insertFrame must not call theme() in hook_init()
MarcElbichon’s picture

To workaround, comment line 43 :

theme('insertFrame_init');
lakyljuk’s picture

Hello.

Thank you guys, problem solved, theme is now switching flawlesly and insertFrame is still working too, after commenting that line out.

MarcElbichon’s picture

Status: Active » Closed (fixed)

Themeable function in hook_init() will be removed in future version.
Custom javascript would be added in insertframe.js