Dashboard Akismet Hack 0.0.3

Dashboard Hack 0.0.3

Akismet is a pop­u­lar com­ment, track­back, ping­back spam blocker. Orig­i­nally it was devel­oped for the Word­Press blog­ging plat­form; it has since been extended to work on a vari­ety of blog­ging and forums sys­tems. How­ever the only part of it I really care about is the Word­Press plu­gin as it is one of the ways I pro­tect this site from spam­mers. Akismet works great1 but there is one thing the devel­op­ers of Akismet have never seen fit to do which dri­ves me bonkers. Which is to say the only place the Akismet plu­gin shows you how many com­ments it has in the spam mod­er­a­tion queue is on the spam mod­er­a­tion queue page. And yet they put some stats for Akismet right there on the Word­Press dash­board. In ages long past, I cob­bled together a small hack to dis­play those mod­er­a­tion num­bers, when I upgraded my site to a more cur­rent ver­sion of Word­Press my hack broke.

This morn­ing I finally fixed it. Peo­ple more clever than myself could make this into a full fledged plu­gin, but this lit­tle hack is good enough for me. To do this:

  1. Down­load a copy of the Akismet plu­gin for WordPress
  2. Decom­press the zip file
  3. Open the akismet.php file in your favorite text edi­tor2
  4. In akismet.php, search for “func­tion akismet_stats()”. It should be around line 510.
  5. In the akismet_stats func­tion, under the line read­ing echo '<h3>'.__('Spam').'</h3>'; add the fol­low­ing code:
    $spam_count = akismet_spam_count();
    $link = 'edit-comments.php';
    if ($spam_count) :
    print "<strong><a href="$link?page=akismet-admin" title="Click here to see the moderation queue">Spam in moderation ($spam_count)</a></strong>\n";
    endif;
  6. Save your changes.
  7. Uploaded your edited copy of akismet.php to http://yourblog.com/wp-content/plugins/akismet/ and then fol­low the nor­mal instruc­tions for installing/activating the Akismet plugin.

With this small hack in place, when Akismet traps some com­ment spam in its mod­er­a­tion queue the Word­Press dash­board will dis­play a link under the Spam in the Lat­est Activ­ity box. The link will say “Spam in mod­er­a­tion (x)” where x is the num­ber of items in the spam mod­er­a­tion queue. Since Word­Press likes to occa­sion­ally man­gle the dis­play of code in posts, I’ve cre­ated a text file with my changes to the akismet_stats func­tion. You down­load that file here.

Update 2007-04-22: As to be expected, it didn’t take the spam­mers long to gen­er­ate some sam­ple data for me to cre­ate a screen­shot of my hack.  Enjoy!

1 Par­tic­u­larly with the Bad Behav­ior anti-spam plu­gin added to it.
2 E.g. Kate

Similar Posts

  • WordPress/Akismet Hack 0.0.2
    Do you run WP? Do you also have Akismet installed? Would you like a quick reference on the Dashboard ...
  • Pukka’s Links of the Week
    Due to recent crackdowns at the office on Internet access, this is likely to be the last PLotW. Also ...
  • Dear Mr. S. Bot
    Dear Mr. S. Bot, Mr. S. Bot, do you mind if I call you Spam? No? Good. I thought I would take a mome ...
  • Funny Comment Spam
    Even though I run multiple plugins to block comment spam; some still makes it into my moderation que ...
  • Now-Reading Tweaks v2
    Some time back, I tried to make Rob Miller's Now-Reading plugin display who's reading each book on t ...

About Mark McKibben

Mark works as a [REDACTED] for [REDACTED], currently residing in Iowa. CoffeeBear.net is a place for him to blather on about whatever strikes his fancy. He currently spends his "free" time working on a photography project, playing with his cat and attempting to keep his wife happy (not necessarily in that order).

2 Comments

  1. Mark says:
    April 21st, 2007 at 11:18 am

    I meant to include a screen­shot of what the link looks like but at the moment my spam mod­er­a­tion queue is empty. Yeah, Akismet! :D Once I’ve got some spam in there, I’ll try to remem­ber to come back and update this post with a screenshot.

Trackbacks/Pingbacks

  1. WordPress/Akismet Hack 0.0.2 | CoffeeBear.net

Leave a Reply

Notify me of followup comments via e-mail. You can also subscribe without commenting.