Posted by bighoffa on February 17, 2009 at 2:15pm
| Project: | Auto Menu |
| Version: | 6.x-1.x-dev |
| Component: | Miscellaneous |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed (fixed) |
Issue Summary
I am having an issue where automenu adds duplicate entries for items. This occurs when a previously added item is edited and saved again. The modules displays a message that the node has been added to the menu tree again.
Comments
#1
I have managed to isolate the issue.
It occurs when using editablefields modules on the node form. When an AJAX update is made to the node, an extra menu item is added.
I don't know enough about drupal coding to isolate whether this is an issue with editablefields or this module.
#2
Has anyone else experienced this problem, or is it isolated to my setup?
#3
I too am experiencing this problem and would be interested if a fix is on the way.
#4
Attached is a quick an dirty fix. Basically, before the update is called, a query of the menu is run. If there exists a menu item that points to this node, that menu id is set to be updated by automenu (rather than a new menu item always being created).
This has some possible downsides that are not relevant in my (and probably most) cases. In particular, if there are intentionally created multiple menu entries that point to the node, the first one found in the DB table will be the one updated. Also, if the menu title no longer matches the node title (someone manually changed it), the menu title will be reset to match the node title.
The patch makes automenu safe to use with the "workflow" module (or at least it now works for me).
#5
Patch above works fine. Only problem is that it uses tabs instead of spaces. Not sure how picky the maintainer is about that, but I'm going to RTBC and they can replace if they want.
#6
Thanks for the patch. But I am new to use drupal, so I don't know where to put this patch.
I put it in drupal>sites>all>modules>automenu>.patch. It doesn't work.
Something is wrong, so can you tell me where i put this patch, or we need to use some special tools?
#7
It works, thank you very much.
I read caredully the content of petch, I copy de code in .module
#8
subscribing
#9
Here's a mod to the patch in #4 by jpeterson. This patch also checks for a matching plid. The menu item will only be updated if the path and plid match. If not a new menu item will be created. This should solve the problem of multiple items pointing to the same path, unless you need to have 2 such items with the same parent.
#10
Thanks! Tested this solution. It seems to work, so committed now.
#11
Automatically closed -- issue fixed for 2 weeks with no activity.