This module provides extra options when deleting a menu item. On the 'Delete menu item' confirmation page you can choose to delete child menu items and decide if the linking nodes should be deleted as well. When the checkbox 'Delete all children of this menu.' is checked, all child menu items of the parent menu item to delete, will be deleted as well. When the checkbox 'Delete nodes of the deleted menu items (only orphaned nodes).' is checked, the nodes to which the child menu items link will be deleted too. When other menu items link to same nodes or aliases as the nodes which were set out to be deleted, those nodes will not deleted.
Project page: http://drupal.org/sandbox/mjgmaas/1886610
Git clone: git clone --recursive --branch 6.x-1.x mjgmaas@git.drupal.org:sandbox/mjgmaas/1886610.git delete_menu_options
Drupal version: 6.x
Comments
Comment #1
mjgmaas commentedComment #2
mjgmaas commentedComment #3
karljohann commentedAutomated review:
http://ventral.org/pareview/httpgitdrupalorgsandboxmjgmaas1886610git
You should also take a look at the tips for a great project page.
Comment #4
mjgmaas commentedI fixed all the reported errors on the automated review and made some improvements to the project page.
Comment #5
jgalletta commentedHi,
I did a manual review of your code, here's the result:
This file is less detailed than the project page, maybe add at least the same amount of information
You should add a dependency to the "menu" Drupal core module that can be deactivated. If Menu is deactivated, the functionalities of your module are not accessible.
l13: see drupal function st() http://api.drupal.org/api/drupal/includes!install.inc/function/st/6
l14: Comments should use proper grammar, add ending dot (your other comments are fine so I think it's a copy/paste mistake)
l22: Mispelled words in sentence, should be "This hook adds 2 checkboxes which the user may select to delete child menu items and/or the referenced node(s)."
l32: The sentence is not very clear, I'd write "Delete nodes referenced by the menu items that will be deleted (orphaned nodes only)."
l84: children and not child
l108: Sentence must finish with a dot.
These issues are very minor, your code is otherwise very nice.
Comment #6
mjgmaas commentedThanks for the review. I have processed all the comments. About the translate function. I have changed is to 'st()' because the install hook will only be called at install time. But now the automated review of ventral.org reports an error about this claiming that I should use get_t().
Comment #7
jgalletta commentedStrange, the Drupal documentation on t() is clear about the use of st() or get_t()...
I would like to have the point of view of someone else on this.
Anyway this is a very minor issue in my opinion.
Just a tiny issue in delete_menu_options.module, but that's because I had to find something:
l22: there is a " character at the end of the sentence, copy paste error :)
All items on the project application checklist looks ok to me, just wait for a reviewer of a "higher rank" to also review your application.
Note that the application process is much more quicker if you take some time to review other applications: Review Bonus
Comment #8
vladimir-m commentedHello mjgmaas,
Thank you for great module.
1. Please add git link corresponding to non-maintainer like "git clone http://git.drupal.org/sandbox/mjgmaas/1886610.git delete_menu_options"
2. You must use placeholders %d for integer values and %s for string values (in db_query
mlid = %s). For example in file: delete_menu_options.module at line: 59db_query("SELECT mlid, link_path FROM {menu_links} WHERE mlid = %s", $item['mlid'])Also at line: 95, 131, 141
Cheers!
Comment #9
PA robot commentedClosing due to lack of activity. Feel free to reopen if you are still working on this application.
I'm a robot and this is an automated message from Project Applications Scraper.
Comment #10
mjgmaas commentedSorry for the lack of activity. I processed the reviewing remarks of jgalletta (#7) and vladimir-m (#8).
Comment #11
sreynen commentedAdding version to title so D6 reviewers can more easily find it.
Comment #12
kscheirerYour project page and README have a heading for GitHub but the code is hosted on git.drupal.org instead.
I'm not sure about the
get_t()vsst()the docs appear to allow either, so it seems like a very minor issue from ventral.org. Hopefully klausi or patrickd will see this issue and can comment on that test.If you don't need to pass any arguments though, no need for the empty array. Just
drupal_set_message(st("The module 'Delete menu options' has been installed successfully"));is sufficient.I've never seen a filter_filter() call like that in hook_help() - that's interesting and possibly awesome.
In delete_menu_options_form_alter() use single-quotes for all your strings if possible, see https://drupal.org/coding-standards#quotes. Also, if you just want to affect a single form, consider using hook_form_FORM_ID_alter() instead, which in this case would become
delete_menu_options_form_menu_item_delete_form_alter().Why does
_delete_menu_options_get_menu_children()have a recursion limit of 10? Wouldn't you want to delete all children regardless of the nesting level?I can see where the node delete is useful, but it could also surprise the user. Since you already know which menu item is about to be deleted, perhaps a nice message on that same page listing nodes which would be affected would help. Then the user knows in advance which nodes will be removed.
Those are all minor issues. I do have one security concern though, I don't see any access checks to ensure that the user has permission to delete those nodes. Those are 2 separate permissions and I don't think you should assume that the user has both. Can you add a node_access() check around that? Unfortunately, I think node_access() requires a fully loaded node object.
Setting to needs work for security question only, otherwise this is RTBC from me.
----
Top Shelf Modules - Enterprise modules from the community for the community.
Comment #13
mjgmaas commentedThanks for the review. I fixed the security issue and some of the minor remarks. I will note down your suggestion to display the nodes which will be deleted if you use the checkbox to do so.
The reason for the check on the recursion limit is a little defensive programming. I stumbled on a case where the recursion function went into an endless loop because the menu items were linked in a circle. A level of 10 seemed enough to me. I don't think menu levels get that deep in practice. To be sure I changed to value to 20.
Comment #14
kscheirerThanks for those fixes, looks ok to me. This review was based on the D6 version.
----
Top Shelf Modules - Crafted, Curated, Contributed.
Comment #15
patrickd commentedComment #16
patrickd commentedI understand that it makes sense to require the "administer nodes" permission to delete all orphaned referenced nodes of a menu entry, but why do you require this permission for deleting all child menu entries? (Not sure whether there's a better permission for this in d6 though)
Anyways, code looks good and has a good amount of inline comments ;)
Thanks for your contribution!
I updated your account so you can promote this to a full project and also create new projects as either a sandbox or a "full" project.
Here are some recommended readings to help with excellent maintainership:
You can find lots more contributors chatting on IRC in #drupal-contribute. So, come hang out and stay involved!
Thanks, also, for your patience with the review process. Anyone is welcome to participate in the review process. Please consider reviewing other projects that are pending review. I encourage you to learn more about that process and join the group of reviewers.
Thanks to the dedicated reviewer(s) as well.