One on the things that happens much i incompatibility with other modules, and it's usually not themekey's fault. I opened this issue to share my experience with debugging this kind of issues.

Comments

sinasalek’s picture

sinasalek’s picture

If ThemeKey debug look ok ,then the first thing i usually check is hook_init using the following code. It shows which module is overwriting themekey config (You can debug other hooks as well) :

//includes/modules.inc
function module_invoke_all() {
  $args = func_get_args();
  $hook = $args[0];
  unset($args[0]);
  $return = array();
  foreach (module_implements($hook) as $module) {
    $function = $module .'_'. $hook;
    $result = call_user_func_array($function, $args);
    if (isset($result) && is_array($result)) {
      $return = array_merge_recursive($return, $result);
    }
    else if (isset($result)) {
      $return[] = $result;
    }
    if ($hook=='init') {
       echo $module.':'.$custom_theme.'<br />'; 
    }
  }

  return $return;
}
sinasalek’s picture

@mkalkbrenner , That would be nice to have note on README.txt or on Debug settings page about this (How to debug incompatibility with other modules)

sinja’s picture

Assigned: Unassigned » sinja

Don't working with Blogtheme. When I deleted Blogtheme all began working correctly.

spatical’s picture

Custom Theme is not shown when used with a node that is also displaying Service Links: #761332: ThemeKey compatibility issue.

mkalkbrenner’s picture

Assigned: sinja » Unassigned
tjharman’s picture

I've done some debugging and I'm getting a problem on the front page of my site.

If I put the above debug lines in, I see that it's views that's causing the problem.
I do have a view on my frontpage (the Archives block)

How I can help to debug this more?

Tim

mkalkbrenner’s picture

Version: 6.x-2.0-rc2 » 6.x-2.0

I'm very interested in debugging issues related to views. I hope to find some time later this month to do so ...

tjharman’s picture

Ok, if there's anything I can do to help you, please let me know.
My site is a personal blog only, so it can be hacked and taken down and formatted etc as much as you please.

Tim

mshepherd’s picture

Confirmed the incompatibility with service lnks.

I'm investigating and I'll post back if I find anything, but if anyone has any light to shine on this... Hints would be welcome! Thanks.

tmckeown’s picture

There is also an incompatibility with hide submit. A possible work around for all these type of issues is to use the util module and set the weight on Themekey to a negative number. This will make it's hook_init function fire before any other module attempts to initialize the theme layer.

hd’s picture

As soon as I enable the "service links" and the "general services" module (version 6.x-2.0), one of my theme switching rules

taxonomy:vid -> "whatever theme"

becomes nonfunctional, whereas other theme switching rules continue to work.

ericpai’s picture

Title: Incompatibility with other modules » Skipped rule checking because another module already initialized the theme engine
Issue tags: +themekey, +rule checking skipped

Themekey is not working at all for me. I get this debug info on my page "mysite.com/halloween".
Skipped rule checking because another module already initialized the theme engine. $theme has been set to theme428.
For my rule chain I have: drupal:path set to halloween. I even tried with node id and it's not working either.

mkalkbrenner’s picture

@ericpai:
Like the debug message tells, it's not ThemeKey that does not work. It's another module that does not respect some drupal coding standards.

We have two possibilities now:
1. adjust the weight of ThemeKey until it works. Therefor you can use a module called util like described here: #772262: Themekey and Webforms

2. debug which module causes the trouble like described here: http://drupal.org/node/754970#comment-2775608

ericpai’s picture

Thanks. I found out it was a line of code I put in the YUI module function yuimenu_init() to get the theme path. I had added this line : $yui_source=path_to_theme();
I changed it to :
$yui_source = variable_get('yui_source','http://yui.yahooapis.com/2.5.0');
$yui_source='sites/mysite.com/'.$yui_source;

Is there a way to get the base theme path? I was trying to switch to a sub-theme using themekey.

thanks

mkalkbrenner’s picture

path_to_theme() returns the right result after you changed a theme.

Is there a way to get the base theme path? I was trying to switch to a sub-theme using themekey

Right now I don't understand exactly what you try to do. But if you explain your requirement more detailed I might be able to help.

tjharman’s picture

If you are using commentrss, then you must download the latest dev version and then apply this patch:

http://drupal.org/node/594484#comment-2839924

I hope this helps someone.

It helped me!

Thanks,
Tim

AlexisWilke’s picture

Note that in many cases changing the themekey module weight to something like -5 will solve all the problems. Although it may generate other problems, of course.

The SQL command goes like this:

UPDATE system SET weight = -5 WHERE name = 'themekey';

Thank you.
Alexis Wilke

jwilson3’s picture

@tjharman, CommentRSS was what was biting me, and your link fixed it. #594484: Calling drupal_add_feed in hook_init breaks theming

Thanks!

greggles’s picture

I also had this problem.

I found that if I disabled the http://drupal.org/project/hide_submit module themekey would work again.

I also just set the themekey module to a -1 weight using AlexisWilke's query from comment #18 and that worked reasonably well too for my site.

mkalkbrenner’s picture

The Drupal 7 version ThemeKey 7.x now solves this problem in a generic way. Therefore a new optional module called ThemeKey Compatibility has been added to ThemeKey 7.x-1.x.

This module allows you to integrate every other theme switching module into ThemeKey's rule switching chain!

Unfortunately this feature could not be back ported to ThemeKey 6.x because it depends on new features of Drupal 7.

mstrelan’s picture

In D6 if any of your modules that are executed before ThemeKey call theme() then the $GLOBALS['theme'] variable will be set and ThemeKey won't do anything.

zarinah’s picture

Thanks for the debugging help. Would have been impossible for me to find otherwise. Note, the exact debugging help didn't work for me. Had to change

if ($hook=='init') {
       echo $module.':'.$custom_theme.'<br />';
}

to

if ($hook=='init') {
       echo $module.':'.$GLOBALS['theme'].'<br />';
}
mrfelton’s picture

ashoksudani’s picture


Thanks AlexisWilke, This worked perfect for me.

ShaneOnABike’s picture

Could I also suggest that if there are common modules that are issues that we put this on the main page for the module. I spent about an hour trying to figure out what was wrong and later realised it was because of Service Links issues.

Also, would be really awesome if the module install just set itself to a -xx weight to help prevent a bunch of problems? What do you think??

Cheers this is an awesome module - no joke.

ShaneOnABike’s picture

The code above works really great although it would be better if we couldn't create a custom module rather than hacking core :/

In my case it was the following modules:

*

  • strongarm (-1000 weight)
  • boost (-90 weight)

I used the same technique in #18 and set it to -1005 (wow) and it's working permanently now :)

It does make me wonder if the setup of this module shouldn't just set itself to a really low negative value by default!

jlyon’s picture

I am having a problem with the media modules filter. I am using media-7.x-1.2. On line 174 of includes/media.filter.inc, there is a call to file_load():

$file = file_load($tag_info['fid']);

This call somehow initiates the theme engine, which invalidates the theme switching the themekey. Can you think of any workarounds? I tried digging into file_load, but it uses an entity_load, so it seems like this is buried deep in Drupal core's internals.

Thanks!

mkalkbrenner’s picture

@jilyon:
Please post a separate support request for your problem, because this issue targets 6.x.
(just copy your posting)

I'll have a look at this.

jlyon’s picture

@mkalkbrenner: My apologies to hijacking this issue queue. I just created a new issue at #1702008: file_load() in media.module overrides themekey setting.

DamienMcKenna’s picture

This is related to a problem some sites have reported with Nodewords (#1986230: ThemeKey doesn't work when Nodewords Open Graph module is enabled) that isn't really caused by Nodewords.

mediaslug’s picture

hey, i know this convo has long been quiet, but i'm not sure where to put this debug code. any guidance is appreciated.

Reg’s picture

Update for #2:

//includes/modules.inc
function module_invoke_all() {
  global $custom_theme;
  $args = func_get_args();
  $hook = $args[0];
  unset($args[0]);
  $return = array();
  foreach (module_implements($hook) as $module) {
    $function = $module .'_'. $hook;
    $result = call_user_func_array($function, $args);
    if (isset($result) && is_array($result)) {
      $return = array_merge_recursive($return, $result);
    }
    else if (isset($result)) {
      $return[] = $result;
    }
    if ($hook=='init') {
      echo $module . ' : ' . menu_get_custom_theme() . '<br />';
    }
  }
  return $return;
}