Fighting Pixelpost spam with Akismet
I enjoy taking lots of pictures, especially of my kids. It wasn’t long before my photo collection grew and so did the necessity of finding software to manage, backup and share my pictures. I’ve tried many different approaches from statically generated files from many different softwares, PHP Gallery, Singapore, etc. However, not everyone wants to see *everyone* of my pictures from every event, so I decided to start a photolog using Pixelpost. My family, friends and I like it. I’m able to exhibit the best of my amatuer photos easily and even once in a while I get a comment from someone saying they like a picture or two. It was all fine until the spammers found it. There’s this one spammer that was driving me crazy. I was getting maybe 30 or more spams a day. The HTTP request users the same user agent everytime, but from a different IP address everytime and posts several variations on medication spam content. At first I tried to disable comments, but Pixelpost wouldn’t let me (I think). I proceeded to disable comments in the code, but Pixelpost still emails me because I didn’t want to lose those three comments a year I get. Now I was annoyed with too many emails when it hit me. Since my last Wordpress upgrade (bundled with Akismet), I’ve never had to deal with comment spam on my weblog, so I decided to retrofit Akismet for Pixelpost and life is good once again. It’s not as fancy as Wordpress’ plugin which saves the spam and deletes after 15 days, it simply doesn’t save in the db, but it does send an email notification with extra text on the subject to indicate it’s spam. I love it. If you want it, I’m sharing my changes to version 1.4.3 but you need to be PHP savvy to do this and of course you’ll need a Wordpress API key. First you need to modify index.php in your Pixelpost directory: Around line 42 add a new require sentence:require("includes/akismet.php");
Remove line 755 that says:
$result = mysql_query($query);
Insert the following instead:
$comment = array( 'comment_post_ID' => $parent_id,
'comment_author' => $name,
'comment_author_url' => $url,
'comment_author_email' => $email,
'comment_content' => $message,
'blog' => $cfgrow['siteurl']);
$comment['user_ip'] = $_SERVER['REMOTE_ADDR'];
$comment['user_agent'] = $_SERVER['HTTP_USER_AGENT'];
$comment['referrer'] = $_SERVER['HTTP_REFERER'];
ksd_auto_check_comment( $comment );
if($auto_comment_approved != 'spam') {
$result = mysql_query($query);
}
Finally save akismet.phps as akismet.php in your includes directory and make sure you enter your Wordpress API key where I instructed you to do so and it’s ready for a spam test. Voila.
There’s also a patch for the PHP and Unix savvy.
About this entry
You’re currently reading “Fighting Pixelpost spam with Akismet,” an entry on Elias Torres
- Published:
- 04.22.06 / 8pm
- Category:
- Photography, Technology, WordPress
Comments are closed
Comments are currently closed on this entry.