D7 dhtml_menu - When clear cache - module stops working.

upon clearing the cache the dhtml menu module stop working and all menu links become unstyled due to the class "dhtml-menu" not being applied to the div elements. When viewing the source of the page, it does show the dhtml js and css file being loaded.

Comments

nastenka’s picture

I have the same problem

sketman’s picture

the same problem here.

tahiticlic’s picture

Same here, don't know why. It seems that a solution (worked for me) is :

  1. in DHTML menu configuration, change the navigation behavior
  2. (clear cache maybe unecessary)
  3. then change the navigation behavior it back to the previous setting
  4. clear cache
  5. that should be ok
tahiticlic’s picture

Hi,

the problem has occured again. Further looking at the code has shown that the dhtml_menu_preprocess_menu_link hook is not invoked when the problem occurs, this means that the registry is not correctly filled.

Wheter this is dhtml_menu_init that is not invoked when refreshing cache (and then refreshing registry) or it is dhtml_menu_preprocess_menu_link itself that is not considered.

For both possible cause, putting the dhtml_menu.theme.inc file inclusion outside of dhtml_menu_init call with

require_once(drupal_get_path('module', 'dhtml_menu')."/dhtml_menu.theme.inc");

at the top of dhtml_menu.module corrects it.

BUT, this is not a good practice to do this (http://drupal.org/node/1751704) and the real cause of the problem should be found.

bensey’s picture

Issue summary: View changes

Well due to the lack of inactivity here, it seems that not that many people are having this issue?

It's happening for me, and in my opinion is such a serious issue that it renders the module unusable.
Having all of your DHTML menus break on a cache clear is crazy.

Anyways, as Fabien points out above, it seems that the hook_preprocess function is not picked up when clearing caches. This seems to be happening as it is inside the dhtml_menu.theme.inc file.

The solution for me was to simply move all of the functions in the dhtml_menu.theme.inc into the dhtml_menu.module file, and remove the module_load_include from the dhtml_menu_init function.

After this when clearing caches the hook is always registered correctly.
If people think this is a workable solution, I'd be happy to submit it a patch so we could get this committed.

joewickert’s picture

Having same problem here. Patch would be great.

jon pollard’s picture

Is this the reason for this module no longer being supported?

cburschka’s picture

Hi, sorry; I haven't worked on this module in years, and there has never been a stable release for D7 (let alone an attempt at a D8 port).

I would now recommend that people use Nice Menus instead, which is actively supported and has a very similar feature set. But I would also be open to passing this project to a new maintainer.

jon pollard’s picture

Hi cburschka, thanks for your response. What would be needed to keep the module active and not marked as a security issue?

charukah’s picture

hi cburschka thank you for great module. Is that module will stable in near feature its use in our production site please send me the update

alienzed’s picture

I am also curious to know why this module has suddenly been giving a security warning with little to no information of any kind explaining why. The sites that I run that use this still work fine but now think they are insecure. What gives?

Sokarion’s picture

This is my patch to apply the solution of comment #5 from bensey