How to reproduce:
1) create content type named "testing"
2) create content type named "testing-again"
You will see something like the attached image where the "Edit" and "Manage Fields" menu items get added at the top level (admin is parent) rather than where they should be. The reason is that one content type name is a substring of another. The code that causes this problem is in admin_menu.inc line 192 that looks like:
if (strpos($path, $type_path) !== FALSE) {
The attached patch simply changes this to:
if (strpos($path, $type_path.'/') !== FALSE) {
though there are other solutions such as using regular expressions.
Most people would not have seen this issue but we did because we have content types that are named similarly (e.g. travel-agent and travel-agent-home)
| Comment | File | Size | Author |
|---|---|---|---|
| #1 | admin_menu-DRUPAL-6--3.strpos.patch | 1 KB | sun |
| admin_menu.inc_.patch | 1.04 KB | kristen pol | |
| admin_menu_wrong_menu_parent.png | 46.11 KB | kristen pol |
Comments
Comment #1
sunPlease test attached patch.
Comment #2
kristen polExcellent. Thanks for the amazingly fast turn around. This is a wonderful module.
Comment #3
sunDid you test the updated patch? Your patch should not have covered the case for the admin/content/node-type/travel-agent item itself (because of the trailing slash).
Comment #4
alan d. commentedJust tested the patch on Drupal 6.6 / Admin Menu 6.x-1.1, as per the duplicate issue http://drupal.org/node/314671
It is working great so far. All of the confused links from the Administer section are now in their correct Content type section with functional links
Many thanks
Comment #5
attheshow commentedJust tested the patch. Works for me. Thanks sun!
Comment #6
sunThanks kepol for discovering the cause! It was not only you - the other issue #314671: Underscores in custom content types breaks the edit content type menu trail was simply a bit "confusing", because of its title and multiple issues reported there.
Also thanks for testing!
Committed! A new development snapshot will be available within the next 12 hours. The next official release will still take some time though (mid March).
Comment #7
kristen polSorry for the delay. I was using version 1.2. I just upgraded to 1.3 (without patch), verified error again. Applied patch, disabled module, uninstalled module, enabled module, and it is indeed working. I'm glad to hear that it applies to another bug as well. Thanks! (A note to those that apply the patch... make sure to disable/uninstall/enable module so that the menu items get rebuilt properly.)
Comment #9
burningdog commentedCan this be committed to 6.x-1.3 as well? I had the same issue and this patch solved it for me.