WordPress/Akismet Hack 0.0.2
Posted by Mark | Filed under WordPress
Do you run WP? Do you also have Akismet installed? Would you like a quick reference on the Dashboard showing you some info from Akismet? I do and did want this. Since I have zero idea on how to set this up as a plugin; I simply added the code into /wp-admin/index.php. I scanned through the file until I found the section of code which creates the “Latest Activity” box. Then between the sections for “Blog Stats” and “Incoming Links“1, I added the following code:
<h3><a href="http://akismet.com/" title="Stop Comment Spam and Trackback Spam « Akismet">Akismet</a> Stats</h3>
<? php
$deadspam = get_option('akismet_spam_count');
$livespam = $wpdb->get_var("SELECT COUNT(comment_ID) FROM $wpdb->comments WHERE comment_approved = 'spam'");
$sitelink = $wpdb->get_var("SELECT option_value FROM $wpdb->options WHERE option_id = '1'");
print "Killed Spam Count: $deadspam\n";
if ($livespam == 0) {
print "Your spam queue is empty!";
} else {
print "<strong>Possible Spam Count: <a href="http://coffeebear.net/wp-admin/$sitelink/wp-admin/edit.php?page=akismet.php" title="Click here to see the moderation queue">$livespam</a></strong>\n";
}
?>
There’s undoubtably a more elegant way of retrieving and displaying this information. And for somebody who actually writes PHP code regularly, this might even be a quick and easy plugin to create. Unfortunately, I’ve only read part of a book about PHP; so this is about as far as I can currently take the hack. Unlike what some people think, WordPress does not require you to be a PHP guru. It only requires a webserver with PHP, MySQL & a little patience2.
NOTE: THIS IS A CORE WORDPRESS FILE! EDIT AT YOUR OWN RISK! I AM NOT RESPONSIBLE IF YOU HOSE YOUR BLOG, SERVER, LIFE, THE UNIVERSE, AND EVERYTHING! BACKUP EVERYTHING BEFORE YOU EVEN CONSIDER ATTEMPTING THIS! ONLY ATTEMPT THIS HACK IF YOU FEEL COMFORTABLE EDITING CORE WORDPRESS FILES.
Update: Neto Cury was kind enough to point out an error in the above code. Though to be fair it’s not entirely my fault. I pasted into this post the exact code I used in my file, but something in WP or one of the plugins I use appears to have changed the first part of the PHP coding from <? php to < ?php. I’m not sure what caused that, but to help people avoid getting errors; I’ve uploaded a text file containing the code for the hack. You can download that file here.
Update #2: Fixed a typo in the previous update. Sorry about that Neto!
Update #3 2007-04-21: I’ve updated this hack to modify the akismet plugin file (Akismet v2.0 for WordPress 2.1.3) instead of one of the WordPress core files. Read about it here.
1 Blog Stats ends at line 85 in my file and at the time of this writing I am running WordPress 1.5.2.
2 This is true of every CMS that I’ve looked at.
Similar Posts
- Dashboard Akismet Hack 0.0.3
Akismet is a popular comment, trackback, pingback spam blocker. Originally it was developed for the ... - Comment Spam
I've been reading the WordPress Support Forums and lately it seems the #1 thing people are posting a ... - 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 ... - Funny Comment Spam
Even though I run multiple plugins to block comment spam; some still makes it into my moderation que ... - Now-Reading Tweaks
I use Rob Miller's excellent Now-Reading plugin to track all the books I've read and am reading here ...
About Mark McKibben
Mark is a data analyst for [REDACTED], currently residing in the Midwest. CoffeeBear is a place for him to spout off about whatever catches his fancy. In his spare time, Mark does a bit of webdev & design. To stalk him more effectively, try following him on Twitter.
9 Comments
Trackbacks/Pingbacks
- WordPress.com.br
- Neto Cury Blog » SUGESTÃO DE CORREÇÃO
- Dashboard Akismet Hack 0.0.3 | CoffeeBear.net
Leave a Reply
Search
Recent Comments
J: That thin layer on top of the yogurt is the cultures.
Tabetha: Do you want to swallow this?! Imagine eating yoghurt eaten out of dog’s rear!
Ewwwwwwww! Light and Fit doggish model or actress sounds and looks like my dog licking his! She may love it but it would be less disgusting to eat yoghurt out of any other container … or no yoghurt at all!
heather: i love dannon coffee yogurt. other brands can't seem to get coffee flavor right. yoplait has a cappucino that is gross and brown cow's coffee yogurt is repulsive.
i can totally see how this is a love it or hate it thing though. the coffee flavor has a tartness to it that is distinctly a yogurt
Stu: I've just had the same problem; it's caused by the brake pedal switch. This switch can be adjusted so that it works properly. Worst possible case is that the switch would need to be replaced. Fortunately all I had to do was adjust the switch's plunger.
jenny: im eating it as i type now, i just tried my first cup and i agree, it is pretty disgusting looking, and it does taste like coffee mixed with sour cream ugh. But im too cheap to throw it away too ahahah. p.s. my first time here, i think you're hilarious xD
Now Reading
The Complete Peanuts 1950-1952 by Charles M. Schulz, Garrison Keillor
Robert Asprin’s Myth Adventures Volume 2 by Robert Asprin













November 24th, 2005 at 11:51 pm
Today, Matt officially announced version 1.11 of Akismet. The above hack was written using WordPress 1.5.2 & Akismet 1.11.
November 25th, 2005 at 12:22 am
Hi,
A little mistake in te code:
<?div>Akismet Stats
< ?php
In the last line, the error occurs because the blank space between < and ?
Dont exist the blank space in there
The correct is:
<?php<?/div>
November 26th, 2005 at 4:45 am
Hey! Thanks for the citation, but cuRRy is an condiment LOL my name is Neto CuRy, with only one R :D
Salute
January 15th, 2009 at 5:35 pm
Do you know if Akismet is available for Blogger?
January 16th, 2009 at 6:48 am
Since Blogger is a service hosted by Google, I don’t believe Akismet is available for it. However you can check out their development community to find out for sure.
January 20th, 2009 at 12:23 pm
blogger rarely gets as much spam as wordpress and there is nothing to the extent of akimset but there are spam blocking options. nice php hack, i like the ease of use of php and the support from the community, dont really understand all the negativity out there around it