Blog Pile

Closing Some of the Comments All of the Time

Back in November 2003, when I was wasting a lot of time dealing with blog spam, I wrote blogged the approach I took to close comments for this site after an entry had been up for 30 days. In a nutshell, I have a timed job calling a PHP script that rummages through the MT database and closes comments for entries that are more than 30 days old.

It worked great.

Except yesterday that it was doing this not just for this blog, but all the other blogs hosted on the server. Not quite what everybody may want, though we heard nary a complaint.

But I found out when Bob Stepno wrote asking, Is that real or phony blog spam in demo blog?

While following links about the NMC conference, I found my way to your previous Breeze thing about RSS… not a bad tool, it seems, and a nice presentation that I’ll point some friends to.

However, if you’re going to link to fictitious blogs (e.g.,, please put a note to that effect on the blogs themselves so that real humans don’t waste their time posting comments trying to interact with the “authors.” (All readers might not get to the disclaimer/credits at the end of the presentation. They might even google themselves into the blog itself.)

Meanwhile, I don’t know if this blog-comment-spam is authentic or also a “demo”… but it’s amusing either way. Yikes, “phony spam” — what a concept!

And sure enough, Boris’ old entry was littered with porn comments and nude people links, likely sneaking in under the radar before we put up the blacklist and closed the comments. Strangely enough, the blog spam cockroaches descended on the post titled “Cool Gizmo”.

Then I started looking around the database and noticed that every entry had its comments value set for closed.

The fix was easy, modify the PHP script so it acted only on one blog. Since I was rzor sharp on my mySQL queries from banging out the last bits of the online dance registration site, this was cake.

First, I needed to add another variable that specified the database ID that identified the blog I want this to act on. Ok this is a kludgy approach and will need modification to make it do more than one, but hey, it is not an elegant code contest.

// Set parameter for which blog to close comments on<br />// Added by Alan Levine 03.03.2004<br />// Of course, you need to scrummage around the database to find this<br />// but I wanted to be selective<br /><br />$the_blog_id = X;

Than it is simply a matter of adding another condition to the mySQL query, not only close comments on entries where the data is older than 30 days, but do so only on the blog I specified:

mysql_query("UPDATE mt_entry SET entry_allow_comments = 2 WHERE<br />
     entry_blog_id = $the_blog_id AND entry_created_on &lt; '$time'")

So now it is set to close only the comments to the dog’s blog and not the other 6-10 ones sitting around here.

If this kind of stuff has any value, please support me monthly on Patreon or a one time PayPal kibble toss
Profile Picture for Alan Levine aka CogDog
An early 90s builder of the web and blogging Alan Levine barks at on web storytelling (#ds106 #4life), photography, bending WordPress, and serendipity in the infinite internet river. He thinks it's weird to write about himself in the third person.