Links being added to wrong menu

webdevandy - December 19, 2008 - 15:37
Project:Auto Menu
Version:6.x-1.x-dev
Component:Code
Category:bug report
Priority:critical
Assigned:AlexisWilke
Status:active
Description

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

AlexisWilke - December 21, 2008 - 23:19
Priority:normal» critical
Assigned to:Anonymous» AlexisWilke
Status:active» needs review

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

AttachmentSize
automenu-6.x-root-menu.patch 495 bytes

#2

sammys - February 9, 2009 - 04:36
Status:needs review» reviewed & tested by the community

Patch works and fixes the issue. RTBC!

#3

farbridges - May 5, 2009 - 12:39
Status:reviewed & tested by the community» fixed

Thanks! Patch indeed works fine and is now committed.

#4

System Message - May 19, 2009 - 12:40
Status:fixed» closed

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

#5

rootdownmedia - December 8, 2009 - 18:13
Status:closed» active

Still having this issue where links do not go to designated parent menus with patch applied. Any ideas?

 
 

Drupal is a registered trademark of Dries Buytaert.