WordPress.org

Support

Support » Plugins and Hacks » Comment Spam – disable comments on older posts

Comment Spam – disable comments on older posts

  • I am currently getting comment spam. The spammer (one gambling site – a stupid one at that) is spamming each post. I’m guessing it’s a script that’s doing it, since they started by having a comment to post 1, then 2, then 3, etc. Some of those posts had been deleted awhile ago so they could not be viewed to comment on.
    Any way to make it so posts over x days old can’t be commented on (or are automatically put into moderation). For example, if a post is over 14 days old, it certainly is not current and on the front page, so all comments should be moderated.
    Any easy hacks/plugins/fixes for this?

Viewing 15 replies - 1 through 15 (of 15 total)
  • TechGnome
    Moderator

    @techgnome

    Check out the wiki ( http://wiki.wordpress.org ) … there’s a plugin called AutoComment Closer (or AutoClose Comments…. something like that) that will work for you. I use it along with WPBlacklist, and don’t have a problem (99.99% spam free).
    TG

    Thanks, I’ll try that.

    Here’s two I found:
    http://weblogtoolscollection.com/index.php?p=48&more=1&c=1
    and
    http://wiki.wordpress.org/Auto%20shutoff%20comments
    The first is in plain enough english I might try it out, the second is not non-coder friendly as I have no idea how to implement it.

    It seems that the problem is because the WP doesn’t check the IP address from which the comment is posted from. I have disabled comments entirely. Even though no-one can view the posts, i’m still getting someone adding comments (to non-existant entries at that). I have just decied to remove the wp-comments-post and wp-comments-reply files entirely.

    TechGnome
    Moderator

    @techgnome

    Go with the second one…. trust me….
    Copy the text that’s in the SECOND example. The one with all the add_Actions in it.
    Copy it from the opening <?php through the end ?>
    Paste it into an empty text file. Make sure there are NO SPACES or carriage returns after the closing ?>….. delete them if they are there. Save the file as autoclose.php. Upload it to your website in the following location: /wp-content/plugins.
    Then go into your Admin area and select “Plugins” from the menu. Find the AutoClose plugin, and activate it.
    The plugin will now close out older posts anytime you perform any of the actions listed in the add_filter section. Edit a post, publish a post, and other actions like that.
    I’ve been using it for some time with mucho success.
    TG

    Thanks TechGnome. I’ll do that right now.
    I tried the first one initially but it had no effect whatsoever.

    It seems to be working. I was averaging one comment spam every 20 minutes from the same turd, but none now in the last hour since I put up that plug-in.

    TechGnome
    Moderator

    @techgnome

    Yeah, the catch is that you have to do something in WP to get the plugin to trigger. Typicvally if you post everyday or at least at some kind of regular interval, it works very well.
    TG

    I was getting this gambling site content spam as well. As the previous plugins probably work good, I think it is a problem to allow comments to be created on posts that no longer exist.
    Adding the simple check:
    if ( !($wpdb->get_var("SELECT ID FROM $tableposts WHERE ID = '$comment_post_ID'")) )
    die( __('Error: that post is no longer available.') );

    Into the wp-comments-post.php file somewhere in there where it checks for other stuff (around line 35) will check and make sure the post exists before adding the comment.

    apparently this issue is solved in 1.2.2 see line 44 in comments-post.php

    very cool i say

    Ok I don’t get the autoclose plugin… I’ve activated, but no what do I do? I’m not very educated in .php so am I to edit something in the plugin? A line of code or something to get old posts to close off comments?

    Mark (podz)
    Support Maven

    @podz

    Johnnie – once it’s in and activate, just forget about it.
    Everytime the db changes, it does it’s job.

    Check it a couple of times if you need to – it’s been active on mine since it came out and hasn’t done harm, or gone wrong.

    James Huff
    Support Team Rep.

    @macmanx

    Or, if you’re still unsure about it and just want to nuke all comments entirely, delete wp-comments-post.php. Otherwise, Podz is right (as always).

    Thanks Podz & Macmanx!!

    Yeah, the catch is that you have to do something in WP to get the plugin to trigger. Typicvally if you post everyday or at least at some kind of regular interval, it works very well.

    TG

    That’s bizarre – why can’t the something be posting a comment? Then it’s updated when you need it most.

    I’ve just made an extra page for wp-admin that lets you bulk delete comments based on key words in post_author or post_content. If anyone reading is competent with SQL and wordpress I’d be grateful if you’d have a look at the “despam” download at http://www.sweavo.34sp.com/downloads
    have a play with it and let me know what you think.

    Back up your comments table first! I don’t think it’s buggy, but the two most likely effects of a bug are:

    1. It doesn’t delete any comments, or
    2. it deletes all your comments!
Viewing 15 replies - 1 through 15 (of 15 total)
  • The topic ‘Comment Spam – disable comments on older posts’ is closed to new replies.