Hi, I'm having an issue with this module. It works quite good, but sometimes, for some reason that I'm not aware of, it doesn't show the view results and only shows the menu item title. does anyone have any idea?

Comments

kourosh.a’s picture

oh! I forgot to mention that after I clear the cache, it works fine again... so it's very random. I've no idea what causes this...

markhalliwell’s picture

Version: 7.x-1.2-rc1 » 7.x-1.2
Priority: Major » Minor
Status: Active » Postponed (maintainer needs more info)

It could very well be that your view is not being rendered (due to permission, context or filter related conditions).

Also, make sure the menu item is always expanded, it could be that your view isn't rendered unless you're on that parent item's page.

kourosh.a’s picture

Hi Mark, I checked those issues and non of them were related to the issue that I have... I guess it's more related to the caching ... Does anyone else have any idea?

markhalliwell’s picture

When you attach the view in the menu item and clear the cache, it works all the time? I'm a little confused by the "it's so very random" bit in your previous message.

If it works fine after you clear the cache, it could very well just be a caching issue. I can certainly insert menu_cache_clear_all(); when saving the menu item and see if this fixes the problem.

kourosh.a’s picture

Hi Mark, Thanks for your reply and sorry about the confusion! Yes it works fine every time cache is cleared. Would you be able to put that menu_cache_clear_all function in ?

codi’s picture

Hey Mark,

I previously posted in http://drupal.org/node/1459424 but I think my problem is more closely related to this issue. I've added the menu_cache_clear_all(); to the end of menu_views_menu_edit_item_submit(); and it seems to be working so far.

areikiera’s picture

@codi (or maintainers),

Could you provide instructions for the solution above? Not sure I follow, and would really love to get this working as well. Thanks so much!

areikiera’s picture

I finally got it to appear again by enabling a theme in the Appearance section. I presume that it would've worked had I just clicked the 'Save configuration' button at the bottom, but that's not exactly how it happened and I wanted to be specific.

I'll post again if it disappears and I can confirm that visiting/saving something on the Appearance tab fixes it.

markhalliwell’s picture

Category: support » bug
Priority: Minor » Major
Status: Postponed (maintainer needs more info) » Needs review

Hey everyone, sorry it's taken a while. I've been able to spend some time on this issue tonight. I went ahead and committed some pretty significant changes: http://drupalcode.org/project/menu_views.git/commit/0d37d03

I have also fixed and included an additional DB update to fix any view attachment misconfigurations in the menu item itself: http://drupalcode.org/project/menu_views.git/commit/1a572c7

These should be in the 7.x-1.x-dev release soon, keep an eye out and let me know if this fixes this issue.

@areikiera: After doing some testing, it seems that when a theme change is done, it only clears the theme's cache, not the menu content. Now that I've fixed the caching in menu views, you shouldn't have to do that anymore. Keep in mind though that a theme or contributed module must support the attached view as it can just appear next to the content and not be styled appropriately.

Thanks!

Yuri’s picture

Thanks for this update, and for an amazing module. Wow this menu rocks!
Test results:

After a regular update procedure (deleting old module, replacing with the new one, then update.php) the existing menu views did not appear, although they were present as correct settings in the corresponding menu items. I always attach the views to a first child of a menu item, which normally should work.
After disabling and re-enabling the module, still nothing appears. clearing the cache of drupal and/or views did not help.
After disabling, uninstalling, removing and re-uploading the module and installing the module, running update.php and clearing all caches, the views appear again! Jay!!

Now the actual test will be if it stays visible. I anything happens I'll report here.

Yuri’s picture

Ah! menu views have dispappeared again.
I used the dev version of 8th March, thinking it already contains the necessary fixes?

areikiera’s picture

@Mark Carver,

Thanks for responding so quickly! After upgrading to the new dev version (released today, 3/8/12), I'm still having the problem. I have no idea what triggers it (this time it seemed to coincide with installing a new module, but that could've been a coincidence). Every time, the workflow I use to get it to work again is the same. Go to 'Appearance', click 'Save configuration', then go to 'Configuration > Performance' and click 'Clear all caches'.

It's the strangest thing. And my inclination is that since it works at all, it isn't a theme support issue. I am using Nice Menus, so perhaps there's a module incompatibility there, but again, since I get it to show up at all, my gut says no, but you know more about module development than I do. Is there something I could be overlooking?

EDIT: Disappeared again. This time, I had to disable the module, re-enable, clear cache again, and it worked.

Yuri’s picture

I am also using Nice menu's, since using Superfish with this menu views did not show up anything. I am using the Omega theme, but i also tried other themes and the disappearing of the menu views doesnt seem to be depending upon the themes I use.
So, it might be that Nice Menu's is having trouble with it. Re-enabling the module only solves it for limited time, after a certain time the views mysteriously disappear from the menu.
Did you test it on Nice Menu's, Mark?

markhalliwell’s picture

@areikiera & @yuri:

It sounds like you might have view access issues. If the view is showing up at random, perhaps there are filters or contexts that should be reviewed. My suggestion:

Clone the view's block that you're attempting to put into the menu. Place that new block, somewhere in the content region and just see if it is being displayed. If it shows up on that page, then the menu should be showing up as well. Also, just because it's not actually visible in the menu, doesn't mean the HTML code isn't there. Please check the source to make sure that the view isn't actually there.

I noticed you also posted in #1459424: Menu views does not work with Nice Menu, and I will again say that there is currently no Nice Menu support. A separate issue must be created with Nice Menus. I was hoping to also create a patch for them to include support for Menu Views, but haven't had the time to create one.

Modules like Nice Menus and Special Menu Item use the same technique this module uses and overrides the theming of the menu links to attach (or render) the special content. It is possible that the menu links aren't being rendered properly due to conflicting modules.

Also, please be aware that a theme can ultimately override the themed output of the menu links using: THEME_NAME_link(). If your theme contains this hook, this could also be part of your problem.

Most developers test against a basic drupal install which contains the default theme Bartik. I can assure you that this modules works on a fresh install of Drupal 7.12 and using the Bartik theme.

Where the issues lie: is with contributed modules. Given that there are literally thousands of them (and each site containing different setups), it is rather difficult to determine what could be causing your errors. It isn't until users like yourselves that have the tenacity, understanding and patience to help troubleshoot these issues. So for this I thank you both :)

Yuri’s picture

Thanks. One thing that I consequently checked in Firebug, is the html of the menu links and/or menu views being present in the page being rendered. When disappeared, none of the html code of the menu views is rendered. Only the (sub) menu link is present which would contain the view.

With regard to not supporting modules like Nice Menu's or Supefish with Menu Views: I actually installed them because Bartik and Omega theme don't support dropdown submenu's out of the box. I'm happy to drop these modules, if I know how the Menu Views gets its dropdown effect of child menu items in Bartik, for example. Mark?

Yuri’s picture

I now see that what makes the menu views to disappear, is clearing the cache in admin/config/development/performance
..but only after some time.
As mentioned before, disabling and enabling the Menu Views module, plus cache clearing makes the menu views appear again, but now i see that after a while, the same clicking of that clear the cache button makes it disappear again.
I'ts like ghost hunting...

markhalliwell’s picture

Thank you Yuri for your continued hunting! I also have been doing my own and it took me a while to actually figure out what the problem was.

I found a very valid (and huge, I might add) bug in Menu Views. The location of hook_theme_registry_alter() should always remain in the .module file, not in any include files (which I had done). What was happening is that when you enabled the module, Menu Views initially altered the theme registry. However, as soon as you cleared the cache... it was a completely random chance if the alter occurred again based on if the include was loaded at the time of the cache clear. I am very surprised it even worked after seeing how this hook is designed to work.

I have committed the following to the 7.x-1.x-dev branch: http://drupalcode.org/project/menu_views.git/commit/9f9c632

After downloading the next dev release, please let me know if this finally resolves the randomness issue.

Thanks!
Mark

Yuri’s picture

haha, looks like you busted the ghost! Using your latest commit the views stay! I'm so happy! Mark, your're doing a great job. One of the most useful modules ever. Thanks!

markhalliwell’s picture

Status: Needs review » Reviewed & tested by the community

Glad to hear :) I will leave this for another 24 hours or so and then make an official 7.x-1.3 release if no one objects! Thank you again all for your help in solving this very tricky bug!

markhalliwell’s picture

StatusFileSize
new1.35 KB

Attaching patch so others don't have to go digging through the repo.

markhalliwell’s picture

Status: Reviewed & tested by the community » Fixed

Released 7.x-1.3.

areikiera’s picture

Version: 7.x-1.2 » 7.x-1.3

Hi Mark!

Thank you so much for you attentiveness to this issue, and to Yuri for continuing to help and test!

Mark, I have to say, this is one of the best experiences I've had in the Drupal forums. You've been a wonderful representative of the Drupal community: sensitive to our experiences, responsive, polite, and a pleasure to talk to! Thank you for being so dedicated to helping us and finding the "ghost" :)

markhalliwell’s picture

I'm very glad I could help :)

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.