Synopsis
This module will delete comments automatically for selected node types of your choice.
Installation
1. Copy the entire comment_delete module directory the Drupal sites/all/modules/custom directory.
2. Login as an administrator. Enable the module in the "Administer" -> "Modules".
Configuration
1. Go to configuration link in admin menu(Configuration -> System -> Comment Delete)
Project Page
This is the project page link for Comment Deletion
PAReview automated test:
http://pareview.sh/pareview/httpgitdrupalorgsandboxchetansharma2408403git
Clone Repository
git clone --branch 7.x-1.x http://git.drupal.org/sandbox/ChetanSharma/2408403.git comment_deletion
Similar Projects
Following are the similar projects,
Comment Delete
comment deletion module depends on comment module. it has configuration setting in the administration area.
Manual reviews of other projects (https://www.drupal.org/node/1975228):
| Comment | File | Size | Author |
|---|---|---|---|
| #15 | UnwantedMenu.png | 17.03 KB | sandeep.kumbhatil |
| Comment Delete.png | 10.99 KB | Chetan Sharma |
Comments
Comment #1
Chetan Sharma commentedComment #2
Chetan Sharma commentedComment #3
Chetan Sharma commentedComment #4
Chetan Sharma commentedComment #5
PA robot commentedThere are some errors reported by automated review tools, did you already check them? See http://pareview.sh/pareview/httpgitdrupalorgsandboxChetanSharma2408403git
We are currently quite busy with all the project applications and we prefer projects with a review bonus. Please help reviewing and put yourself on the high priority list, then we will take a look at your project right away :-)
Also, you should get your friends, colleagues or other community members involved to review this application. Let them go through the review checklist and post a comment that sets this issue to "needs work" (they found some problems with the project) or "reviewed & tested by the community" (they found no major flaws).
I'm a robot and this is an automated message from Project Applications Scraper.
Comment #6
Chetan Sharma commentedComment #7
nileshlohar commentedAutomated Review
Looks good
Manual Review
'#options' => node_type_get_names(),
rather callinng function and setting variable ?
Correcting Title and setting priority to Normal as you cannot set priority to critical.
Comment #8
Chetan Sharma commentedThanks nileshlohar. I look into the issues..
Comment #9
valentine94Some notice for you:
In hook_batch_finish(), line 107:
Can be changed to:
Comment #10
Chetan Sharma commentedThanks for your suggestion @Valentine94
Comment #11
Chetan Sharma commentedComment #12
valentine94Looks good to me - RTBC.
Also would be good if you will fix an indent near a 103-106 lines(Drupal Coding standards).
Regards, Valentine.
Comment #13
valentine94Comment #14
Chetan Sharma commentedHi Valentine Matsveiko,
It is okay, there is no need for indent.
Comment #15
sandeep.kumbhatil commentedAutomated Review
Looks fine
Manual Review
admin/comment_delete_batchchange menu type fromMENU_DEFAULT_LOCAL_TASKtoMENU_CALLBACK, Due to this there is an unwanted link is created on administrator page. Changing status as Need workThe starred items (*) are fairly big issues and warrant going back to Needs Work. Items marked with a plus sign (+) are important and should be addressed before a stable project release. The rest of the comments in the code walkthrough are recommendations.
If added, please don't remove the security tag, we keep that for statistics and to show examples of security problems.
This review uses the Project Application Review Template.
Comment #16
Chetan Sharma commentedHi Sandeep,
I have implemented the change which you have suggested please verify thanks for your suggestion.
Comment #17
rajeev_drupal commentedComment #18
vishalgala commentedViews Bulk operations also provides the same functionality to list and delete the comments of specific node types.Please add the difference on the project page how its functionality is different from the VBO
Comment #19
Chetan Sharma commentedHi vishalgala,
For the Comment Delete in VBO, You need to create a view for content's comment of particular type. But in case of comment deletion module, It is not necessary.
Comment #20
rajeev_drupal commentedReviewing this....
Comment #21
rajeev_drupal commentedAutomated Review
No. Coder is still giving indentation error.
Please add 2 more space on line 103 to 106.I tried on local and it's working fine after that.
Manual Review
The starred items (*) are fairly big issues and warrant going back to Needs Work. Items marked with a plus sign (+) are important and should be addressed before a stable project release. The rest of the comments in the code walkthrough are recommendations.
If added, please don't remove the security tag, we keep that for statistics and to show examples of security problems.
This review uses the Project Application Review Template.
Comment #22
rajeev_drupal commentedComment #23
Chetan Sharma commentedHi Rajeev,
I have done with the indent error. Please review. thanks for the time..
Comment #24
rajeev_drupal commentedNow it looks fine. Making it RTBC..
Comment #25
sandeep.kumbhatil commentedComment #26
sandeep.kumbhatil commentedComment #27
sandeep.kumbhatil commentedComment #28
joachim commentedSorry, but this has quite a few problems, including some obvious code formatting issues!
No such hooks. Please review the documentation guidelines for hook implementations and functions!
This should be translated.
If this is an error, then pass 'error' to drupal_set_message. Also, the message is not a proper sentence.
You're using Batch API, which is great, but you're then not actually making use of it properly. Your batch operation will only ever run once. You're loading ALL the nodes of one type in one go, which won't scale: on larger sites, this will simply crash.
It's not good practice to add your own items directly below the 'admin/' path.
Comment #29
garfield7 commentedChanges implemented according to comments.
Comment #30
garfield7 commentedComment #31
klausiRemoving review bonus tag, you have not done any manual reviews, you just posted the output of an automated review tool. Make sure to read through the source code of the other projects, as requested on the review bonus page.
Comment #32
ayesh commentedHi Chetan,
Thanks for this!
I went through your code, and found a few inefficient/problematic uses of the
t()function. I maintain quite a lot of sites with localized languages, and number 1 issue we face when it comes to translation is that the wrong uses of t() function makes it difficult for other translators to translate the string literals. Read the api doc first if you have not taken a thorough look.comment_delete.module:93: Use t() function, and do not include HTML inside the t() function string. You can put them outside the t() call, and concatenate strings.
'<pre>' . t('<strong>Note:</strong> Execute Batch for delete Comments for the selected content type.') . '</pre>'comment_delete.module:105: Why does it store the function name in a variable, and then call it? Can't it call it directly?
node_type_count: Consider renaming this function to a module name-prefixed one.
comment_delete_node_type_count()?There are many other code styling, documentation and best practices issues reported in pareview.
Also, I would reconsider how the module works in terms of usability.
When you delete comments of a specific node type, that is a one-time operation in almost all cases. So, storing the content type names in a variable doesn't make sense. A form submit handler can perfectly execute a batch (call batch_set and batch_process() in sequent). I think it would make more sense if the module offered a simple admin UI, and upon form submission, it immediately executes the batch with the just-submitted data.
Also, a batch process can usually handle many nodes. If there are 20,000 nodes in a site, a better approach would be to add an operation for each node, so the progress counters indicate how many nodes have been processed. You can call comment_delete_multiple on all comments found in a single node.
There's even a function that you can use directly! See
comment_node_delete().A per-node comment delete approach would also make sense if you plan to expose it as an admin option in admin/content page and/or
Comment #33
daria.a commentedHello Chetan Sharma!
Manual Review:
Individual user account
Yes, follows the guidelines for individual user accounts.
No duplication
Yes, doesn't cause module duplication and/or fragmentation.
Master Branch
Yes, follows the guidelines for master branch.
Licensing
Yes, follows the licensing requirements.
3rd party assets/code
Yes, follows the guidelines for 3rd party assets/code.
README.txt/README.md
Yes, follows the guidelines for in-project documentation and/or the README Template.
Code long/complex enough for review
Yes, follows the guidelines for project length and complexity.
Coding style & Drupal API usage
1. (*) Pareview.sh detected some problems in your code.
http://pareview.sh/pareview/httpgitdrupalorgsandboxchetansharma2408403git
2. (*) I've found one problem with funcionality of your module. If there are
more than 5 comments on a nodes of a given content type, only 5 of them will
be deleted. Other comments will remain there.
Limit is set to 5 at your code, see line 142 in a .module file.
3. (*) Function comment_delete_settings_form() (in .admin.inc file) is not hook.
Add comments for function node_type_count() and rename it (function shold be
prefix 'comment_delete').
The starred items (*) are fairly big issues and warrant going back to Needs Work. Items marked with a plus sign (+) are important and should be addressed before a stable project release. The rest of the comments in the code walkthrough are recommendations.
Comment #34
Chetan Sharma commentedChanges implemented according to comments.
Comment #35
Sonal.Sangale commentedWorks fine for me.
Comment #36
TimRutherford commentedAutomated Review
All good here. Pareview.sh is clean but you might want to add some test cases though (SimpleTest).
Manual Review
The starred items (*) are fairly big issues and warrant going back to Needs Work. Items marked with a plus sign (+) are important and should be addressed before a stable project release. The rest of the comments in the code walkthrough are recommendations.
If added, please don't remove the security tag, we keep that for statistics and to show examples of security problems.
This review uses the Project Application Review Template.
Comment #37
Chetan Sharma commentedCode implement suggested by "TimRutherford".
make right call "batch_set()" inside the function. Removed comment_delete_batch_process() function and call batch_set directly inside comment_delete_batch_submit() function. Thanks for your Suggestion.
Comment #38
adam_ commentedIndividual User Account?
Yes: Chetan Sharma has an individual User Account.
No duplication?
Views Bulk Operations can do something similar, but the differences were addressed by the author in comment #18.
Master Branch?
Yes: Default branch is set to 7.x-1.x
Licensing?
Yes: Project is following the licensing rules.
3rd party assets/code?
No 3rd party assets or code present.
README.txt/README.md?
README.txt present.
Is the secure code?
Code meets security requirements.
Code long/complex enough for review?
Yes: The code present in this module is enough for review.
Recommendation: In comment_delete.module line #94 ‘Note: Execute Batch for delete Comments for the selected content type.’ should be run through the translation function t().
The module worked for me, looks good, does as advertised.
Marking as RTBC.
Comment #39
Chetan Sharma commentedComment #40
Chetan Sharma commentedComment #41
Chetan Sharma commentedBonus Link
https://www.drupal.org/node/2364165#comment-10836848
https://www.drupal.org/node/2364165#comment-9538637
https://www.drupal.org/node/2364165#comment-10334693
Comment #42
Chetan Sharma commentedComment #43
Chetan Sharma commentedComment #44
Chetan Sharma commentedComment #45
Chetan Sharma commentedComment #46
Chetan Sharma commentedComment #47
klausiRemoved one automated review.
Comment #48
klausimanual review:
'#suffix' => '<pre><strong>Note:</strong> Execute Batch for delete Comments for the selected content type.</pre>',: all user facing text must run through t() for translation.Thanks for your contribution, Chetan Sharma!
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.
Comment #49
Chetan Sharma commentedThanks klausi for your support.
I will make chages suggested By You(klausi).
Comment #51
avpaderno