I have a couple of sites now where some spambot (presumably) is adding comments that contain only whitespace. I could probably make some sort of filter using the spam module to block them, but it seems like that's something that should be in the core module.
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | comment_content_empty.zip | 631 bytes | peterx |
Comments
Comment #1
magico commentedComment #2
peterx commentedThe enclosed module uses hook_comment to check for empty comments during validation. The following lines perform the test. Please test and comment.
If you test only for whitespace, you could have HTML and XML that does not display but gives the appearance of an empty comment. There must be code to trim the comment because some comments pass the comment.module test of
if(empty($comment))but end up in the database with an empty body. Someone has to trace the comment code to work out the circumstances where the database receives an empty comment body and test for that condition in the validation function. The enclosed module is a way to test the tests until you are sure you have the right tests and then submit the tested tests for addition to comment.module.Comment #3
magico commentedIt's a feature, so goes in 6.x-dev
Please create the patch that can be applied in the core. See also http://drupal.org/node/67972