Links being added to wrong menu
| Project: | Auto Menu |
| Version: | 6.x-1.x-dev |
| Component: | Code |
| Category: | bug report |
| Priority: | critical |
| Assigned: | AlexisWilke |
| Status: | active |
Hello, I will try to give as much information as I can about the problem I am experiencing.
I have the following content types:
Page
News Story
External Link
Using AutoMenu, I have managed to set News Stories and External Links to be automatically added to the "Primary Links" menu as children of the "News" and "Links" pages respectively. There is no problem with this.
I want nodes of type Page to be (by default) children of "" - so they get added in to the menu, but at the top tier. I am hoping to be able to get a navigation structure such as:
Home
About Us
News
- news 1
- news 2
Links
- link 1
- link 2
- link 3
Contact Us
New Page 1
New Page 2
Where "news 1" and "news 2" are added by default with "News" as the parent, "link 1", "link 2" and "link 3" are added by default with "Links" as the parent and "New Page 1" and "New Page 2" added by default with "" as the parent.
However, when I add a Page in this way, it is automatically added to the Navigation menu (the admin navigation menu) instead of the Primary Links menu. I have double checked that I have set up the content types correctly, as far as I can tell, it seems to be a bug with how the module is operating.
I am wondering if firstly, anyone can recreate the problem I am having, and secondly, is there a fix?
Many Thanks,
Andy

#1
Yes, there is a fix, I have a patch here.
I have got the same problem. It is a one liner fix. On line 16 of the automenu.module file, you need to specify the menu name because the plid is not sufficient to determine the parent when you are trying to add a menu in the root.
<?php$new_menu = array(
'menu_name' => $parent_menu[0], // <-- add this line
'link_path' => 'node/' . $node->nid,
'link_title' => $node->title,
'plid' => $parent_menu[1],
//'customized' => true, // ?
);
?>
Thank you.
Alexis Wilke
#2
Patch works and fixes the issue. RTBC!
#3
Thanks! Patch indeed works fine and is now committed.
#4
Automatically closed -- issue fixed for 2 weeks with no activity.
#5
Still having this issue where links do not go to designated parent menus with patch applied. Any ideas?