I got nailed!

This morning I awoke to being absolutely blitzkreiged with trackback spam. So with a couple of quick SQL queries, I was all happy with the world again. BUT, that isn’t the end of it, unfortunately because you know how these bastards are: they just keep coming back.

Have no fear, you probably already have what you need!

If you’re using the Auto Shutoff Comments plugin (and if you aren’t, why the hell aren’t you? No one wants to legitimately talk about old shit!), it’s relatively easy.

By default the plugin only stops comments from being posted after a certain date, but allows old posts to still be trackbacked. In order to fix that, just add the following line to the .php file:

$wpdb->query ("UPDATE $tableposts SET ping_status = 'closed' WHERE post_date < '$cutoff_date' AND post_status = 'publish'");

right under the line where the Update command says SET comment_status=’closed’. The final lines in the update section of the script will now look like this:

$wpdb->query ("UPDATE $tableposts SET comment_status = 'closed' WHERE post_date < '$cutoff_date' AND post_status = 'publish'");
$wpdb->query ("UPDATE $tableposts SET ping_status = 'closed' WHERE post_date < '$cutoff_date' AND post_status = 'publish'");

I know. You love me.

Seriously, this will close the ping ability on all posts older than a number of days you specify in the script.

Simple.

Effective.

And the nice thing about this is that it runs everytime you write a post or someone writes a comment, or any other database is within your WordPress install is updated. As Ron Popeil says on his infomercials, just "set it and forget it!"

This entry was posted in Cool, Unfiled. Bookmark the permalink.
  • http://www.stageleft.info stageleft

    Actually I don’t use the “Auto Shutoff Comments” plugin and have no intention of ever installing it…. as a matter of fact I spent the time installing the “YearAgo Today” plugin so that the older stuff is more accessible and, hopefully, discussed again in light of changing times, new information, and evolving personal philosophies.

    Remember Santayana and

    Those who do not remember the past are condemned to repeat it.

    :lol:

  • http://www.insignificantthoughts.com Vinny

    Screw that. The benefits of shutting down comments far outweigh the one legitimate comment I get on an old post.
    :roll:

  • http://www.robertkbrown.com/ RKB

    I had a suprising number of trackbacks today, too, which got past my homebrew comment spam fix. Of course, I’d turned off my blacklist moderation, which does the same as what you’ve described above (no trackbacks on posts older than seven days or so), so I get what I get. Might try something else, still. I’m all for keeping comments open, but there’s really no need for old trackbacks.

  • http://www.insignificantthoughts.com Vinny

    If you were using the Auto Shutoff plugin, you could just delete the code that does the closing on comments.

    But you aren’t using WordPress, you silly silly boy :-)

  • http://www.robertkbrown.com/ RKB

    Actually gonna try out WP for a site I’m building for my wife’s 15 year reunion — I want an easy way for her (or other volunteers) to manage and maintain some pretty simple content, including a list sidebar. As much as I love MT, methinks WP has a somewhat cleaner, more user-friendly interface.

  • http://www.stageleft.info/ stageleft

    Actually I don’t use the “Auto Shutoff Comments” plugin and have no intention of ever installing it…. as a matter of fact I spent the time installing the “YearAgo Today” plugin so that the older stuff is more accessible and, hopefully, discussed again in light of changing times, new information, and evolving personal philosophies.

    Remember Santayana and

    Those who do not remember the past are condemned to repeat it.

    :lol:

  • http://www.insignificantthoughts.com/ Vinny

    Screw that. The benefits of shutting down comments far outweigh the one legitimate comment I get on an old post.
    :roll:

  • http://www.robertkbrown.com/ RKB

    I had a suprising number of trackbacks today, too, which got past my homebrew comment spam fix. Of course, I’d turned off my blacklist moderation, which does the same as what you’ve described above (no trackbacks on posts older than seven days or so), so I get what I get. Might try something else, still. I’m all for keeping comments open, but there’s really no need for old trackbacks.

  • http://www.insignificantthoughts.com/ Vinny

    If you were using the Auto Shutoff plugin, you could just delete the code that does the closing on comments.

    But you aren’t using WordPress, you silly silly boy :-)

  • http://www.robertkbrown.com/ RKB

    Actually gonna try out WP for a site I’m building for my wife’s 15 year reunion — I want an easy way for her (or other volunteers) to manage and maintain some pretty simple content, including a list sidebar. As much as I love MT, methinks WP has a somewhat cleaner, more user-friendly interface.