Closed (works as designed)
Project:
Drupal core
Version:
6.15
Component:
menu.module
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
3 Feb 2010 at 16:09 UTC
Updated:
27 Oct 2010 at 21:47 UTC
My module provides a 'user/%user/reports' link via hook_menu. Also a custom menu is added in mymodule.install file just like menu module itself does it (insert to menu_custom).
When I declare a 'menu_name' option for my link, it doesn't work. I see it in Navigation menu instead. That is probably because of 'user/' part in it. When I change module-provided link to simply 'reports', it appears in my menu instantly. How can I change menu for this link programmatically, without admin interface? And is it a bug or normal behaviour?
Comments
Comment #1
jaypanI can't even get menu_name to work for a top level link. I have created a top level url at www.example.com/kairanban. I created a custom menu called top-menu, and I added the block to my site. All the links that I have manually added show up fine, but the link I added to this menu in hook_menu does not work. I have defined it like this:
The link is properly added to navigation if I don't add 'menu_name', so I know the rest of my menu definition is fine, but it doesn't appear when I put it in the custom menu.
Comment #2
dreamdust commentedFigured this out! It's extremely counter-intuitive.
Drupal 6's menu system doesn't evaluate %user into links, you have to use %user_uid_optional instead.
This makes no sense to me, but I finally discovered it after looking in user.module.