Plugin: No Duplicate Comments

This plugin has been deprecated! It is no longer necessary as its functionality has been integrated into WordPress. There will not be any continued support for it. Comments to this post are also now closed.

When I released the plugin, I also simultaneously made a bug report and patch for the WP core, which was quickly accepted and applied.

Reported as a bug in trac ticket #1265.
Fixed in WordPress in changeset #2561.

Name:
No Duplicate Comments
Author:
Scott Reilly
Version:
0.9.2
Last updated:
19 April 2005
Download:
Description:

Prevent visitors from leaving duplicate comments/pingbacks/trackbacks to a post.

Notes:

* Requires at least WordPress 1.5.

* A duplicate is a comment/pingback/trackback that meets these criteria:
Its contents match that of another comment in the same post
-AND-
Either the commenter’s name or e-mail address (if provided) also match.

I won’t claim this approach won’t lead to false-positives, but as far as I’m concerned it’s reasonable.

* If a comment is deemed to be a duplicate, an error page is displayed to the user indicating as much.

Installation:
  1. Download the file no-duplicate-comments.zip and unzip it into your /wp-content/plugins/ directory.
    -OR-
    Copy and paste the the code ( no-duplicate-comments.phps ) into a file called no-duplicate-comments.php, and put that file into your /wp-content/plugins/ directory. Please ensure you do not introduce any spaces or other characters before the <?php or after the ?>
  2. Activate the plugin from your WordPress admin ‘Plugins’ page.
Functions:

function c2c_no_duplicate_comments ( $comment_text )

  • $comment_text : The text of the comment to be checked for duplication.
Tips & Examples:

N/A

Release Log:
  • 19 Apr 2005 : v0.9.2 — Changed addslashes_gpc() call to addslashes(), and added a couple more such calls. (Thanks again, Minna!)
  • 03 Apr 2005 : v0.9.1 — Added addslashes_gpc() call so quotes in comment text don’t cause problems. (Thanks, Minna!)
  • 30 Mar 2005 : v0.9 — Released to the public
Copyright & Disclaimer:

Copyright (c) 2005 by Scott Reilly (aka coffee2code)

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Acknowledgements:
N/A

27 thoughts on “Plugin: No Duplicate Comments

  1. Pingback: Blogging Pro
  2. Interesting idea. Have you given any thought to searching the whole DB rather than just the current post? I receive tons of trackback spam that is identical across multiple posts. Querying the whole DB would practically insure that they only get one through.

    The downside being of course if your blog is very active and your DB is large.

    Thanks for the plugin!

    -jab

  3. Hey, I’m loving your plugins. Using a lot of them.
    I just noticed a thing with this one, No Duplicate Comments. There’s an SQL error if there’s a single quote in the comment text. I can’t be 100% sure it’s because of the plugin, but when I deactivated it, there were no errors and when I activated it again, there were errors. All comments got through though ok. Don’t know if this has happened to anyone else…

  4. jab: I may optionally add a check for duplicates across all comments to a blog.

    Minna: You’re right. I just released a new version of the plugin which should fix the bug you spotted. Let me know if the plugin continues to be problematic for you. Thanks for reporting!

  5. Matt: I believe I checked and didn’t find precisely this kind of measure in WP. There’s the flood protection, which prevents someone from posting more than once per 15 seconds, and there’s a check for duplicate trackbacks/pingbacks. I don’t think there’s an explicit check for duplicate comments. Granted, this probably isn’t a high-occurrence kind of thing, but I have had it happen.

  6. I like this plugin. However, I have found that if a person types in a comment that has an apostrophe in it, the SQL statement that checks for duplicate comments crashes.

  7. Hey again. I’m still getting the errors, too, with 0.9.1. I tried removing the _gpc from the addslashes function you had used and now it seems to work. Tell me if I did something horribly wrong :)

  8. hey im getting this error *** Warning: Cannot modify header information – headers already sent by (output started at /home/china/public_html/wp/wp-content/plugins/no-duplicate-comments.php:80) in /home/china/public_html/wp/wp-admin/admin.php on line 6

    Warning: Cannot modify header information – headers already sent by (output started at /home/china/public_html/wp/wp-content/plugins/no-duplicate-comments.php:80) in /home/china/public_html/wp/wp-admin/admin.php on line 7

    Warning: Cannot modify header information – headers already sent by (output started at /home/china/public_html/wp/wp-content/plugins/no-duplicate-comments.php:80) in /home/china/public_html/wp/wp-admin/admin.php on line 8

    Warning: Cannot modify header information – headers already sent by (output started at /home/china/public_html/wp/wp-content/plugins/no-duplicate-comments.php:80) in /home/china/public_html/wp/wp-admin/admin.php on line 9
    ***
    when i activate the plugin. i have no spaces before or after … what am i doing wrong?

Comments are closed.