So I have some custom menu links that start with administration/xxxx. The term administration is relevant for my domain and my menu paths. However in admin_enable() and in one of the update hooks, the code does the following
$result = db_query("SELECT * FROM {menu_links} WHERE link_path LIKE 'admin%'");
while ($item = db_fetch_array($result)) {
_menu_delete_item($item, TRUE);
}
So the few times i have disabled/enabled this module it killed all of my menus start with administration. I think what you mean to do is:
$result = db_query("SELECT * FROM {menu_links} WHERE link_path = 'admin' OR link_path LIKE 'admin/%'");
Can you tell me if this is what you really intended? I can submit a patch if so.
Comments
Comment #1
febbraro commentedPatch attached
Comment #2
febbraro commentedBump. This is a real easy one, can someone please take a look and get this into the 6-1 branch?
Comment #3
irakli commented+1 bump :)
Comment #4
raines37 commentedStill not updated in 2.0 release. Here's an updated patch....
Comment #5
_vid commentedIt turns out this also menu items pointing to admin pages created with the Bookmarks module. Which is pretty upsetting...
I'll take a look at the patch. Perhaps it could be updated to only delete rows that meet the link_path = 'admin' OR link_path LIKE 'admin/%' but also check to see if the menu_name = 'navigation'.
Otherwise it would need to specifically accommodate modules like bookmarks by including code to check that the menu_name is not like 'bookmarks-%'.
Not having delved into this much, I'm assuming the goal is to eliminate the extra 'navigation' menu items.
Comment #6
trunks commentedWhy removing all menu entries which start with 'admin/'? It's actually an ilogical behaviour. If I define some administration views in this path, enabling this module will remove all the menu entries without any advice to the user. In fact, what's the reason because this module removes all the menu entries below /admin/ ?
Comment #7
_vid commentedGoal: improve admin link target deletes, specifically in navigation menu items
I had a chance to look at the patch today and I did want to add one more qualifier:
AND menu_name = 'navigation'. As far as I can tell the intent of this module is only to affect the navigation menu.To do that I also added (paren's) around the 'admin', 'admin/%' code used in the earlier patch.
So the new line reads:
$result = db_query("SELECT * FROM {menu_links} WHERE (link_path = 'admin' OR link_path LIKE 'admin/%') AND menu_name = 'navigation'");I'm going to deploy a fresh site and then install the patched 6.x-2.0 version and then again with a patched 6.x-2.x-dev version.
@skwashd,
@yhahn,
@jmiccolis,
@technicolorenvy,
@mfer, would one of you review this patch as well and with your nod of approval include it in the next release?
Comment #8
_vid commentedThe patched module worked great on a clean install with several bookmarks that pointed to admin/ pages.
Here were my reproducible steps:
Success.
I even repeated this twice to be sure.
If there are any other test scenarios that someone would like me to run I can try and get to that this week.
I'm going to repeat these steps with the patched dev version next.
Comment #9
sickness29 commentedDevelopment or support is not planned for D6. All D6-related issues are marked as outdated in a bunch.
Everyone can apply the patch above (not tested by the maintainers, tested by the community) to their D6 projects.
If the issue remains relevant for D10+ versions, merge requests with proposed solutions for a new module version (D10+) are welcome in a new follow-up issue.
Thanks!