<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>CoffeeBear.net &#187; akismet</title>
	<atom:link href="http://coffeebear.net/tag/akismet/feed/" rel="self" type="application/rss+xml" />
	<link>http://coffeebear.net</link>
	<description></description>
	<lastBuildDate>Fri, 10 Feb 2012 00:53:08 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=</generator>
		<item>
		<title>Dashboard Akismet Hack 0.0.3</title>
		<link>http://coffeebear.net/2007/04/21/dashboard-akismet-hack-003/</link>
		<comments>http://coffeebear.net/2007/04/21/dashboard-akismet-hack-003/#comments</comments>
		<pubDate>Sat, 21 Apr 2007 16:13:11 +0000</pubDate>
		<dc:creator>Mark</dc:creator>
				<category><![CDATA[WordPress]]></category>
		<category><![CDATA[akismet]]></category>
		<category><![CDATA[WebDev]]></category>

		<guid isPermaLink="false">http://coffeebear.net/archives/2007/04/21/dashboard-akismet-hack-003/</guid>
		<description><![CDATA[Akismet is a popular comment, trackback, pingback spam blocker. Originally it was developed for the WordPress blogging platform; it has since been extended to work on a variety of blogging and forums systems. However the only part of it I really care about is the WordPress plugin as it is one of the ways I [...]]]></description>
			<content:encoded><![CDATA[<p class="alpha-shadow"><a href="http://akismet.com/"><img src="http://coffeebear.net/wp-content/uploads/2007/04/wpdashboardhack.jpg" alt="Dashboard Hack 0.0.3" /></a></p>
<p>Akismet is a popular comment, trackback, pingback spam blocker.  Originally it was developed for the WordPress blogging platform; it has since been extended to work on a variety of blogging and forums systems.  However the only part of it I really care about is the WordPress plugin as it is one of the ways I protect this site from spammers.  Akismet works great<sup>1</sup> but there is one thing the developers of Akismet have never seen fit to do which drives me bonkers.  Which is to say the only place the Akismet plugin shows you how many comments it has in the spam moderation queue is on the spam moderation queue page.  And yet they put some stats for Akismet right there on the WordPress dashboard.  In ages long past, I cobbled together a small <a href="http://coffeebear.net/archives/2005/11/24/wordpressakismet-hack-002/" title="WordPress/Akismet Hack 0.0.2 | CoffeeBear.net">hack</a> to display those moderation numbers, when I upgraded my site to a more current version of WordPress my hack broke.</p>
<p>This morning I finally fixed it.  People more clever than myself could make this into a full fledged plugin, but this little hack is good enough for me.  To do this:</p>
<ol>
<li><a href="http://akismet.com/download/">Download</a> a copy of the Akismet plugin for WordPress</li>
<li>Decompress the zip file</li>
<li>Open the akismet.php file in your favorite text editor<sup>2</sup></li>
<li>In akismet.php, search for “function akismet_stats()”.  It should be around line 510.</li>
<li>In the akismet_stats function, under the line reading <code>echo '&lt;h3&gt;'.__('Spam').'&lt;/h3&gt;';</code> add the following code:<br />
<code>$spam_count = akismet_spam_count();<br />
$link = 'edit-comments.php';<br />
if ($spam_count) :<br />
print "&lt;strong&gt;&lt;a href="$link?page=akismet-admin" title="Click here to see the moderation queue"&gt;Spam in moderation ($spam_count)&lt;/a&gt;&lt;/strong&gt;\n";<br />
endif;</code></li>
<li>Save your changes.</li>
<li>Uploaded your edited copy of akismet.php to <a href="http://yourblog.com/wp-content/plugins/akismet/" class="linkification-ext" title="Linkification: http://yourblog.com/wp-content/plugins/akismet/">http://yourblog.com/wp-content/plugins/akismet/</a> and then follow the normal instructions for installing/activating the Akismet plugin.</li>
</ol>
<p>With this small hack in place, when Akismet traps some comment spam in its moderation queue the WordPress dashboard will display a link under the Spam in the Latest Activity box.  The link will say “Spam in moderation (x)” where x is the number of items in the spam moderation queue.  Since WordPress likes to occasionally mangle the display of code in posts, I’ve created a text file with my changes to the akismet_stats function.  You download that file <a href="http://coffeebear.net/wp-content/wpakismethack.txt" title="Dashboard Akismet Hack 0.0.3">here</a>.</p>
<p><strong>Update 2007-04-22:</strong> As to be expected, it didn’t take the spammers long to generate some sample data for me to create a screenshot of my hack.Â  Enjoy!</p>
<p><sup>1</sup> Particularly with the <a href="http://www.bad-behavior.ioerror.us/">Bad Behavior</a> anti-spam plugin added to it.<br />
<sup>2</sup> E.g. <a href="http://kate-editor.org/">Kate</a></p>
<p><small><a href="http://coffeebear.net/2007/04/21/dashboard-akismet-hack-003/">Dashboard Akismet Hack 0.0.3</a> © <a href="http://coffeebear.net" rel="cc:attributionURL">Mark McKibben</a>, <a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/3.0/us/">Creative Commons Attribution-NonCommercial-ShareAlike 3.0 United States</a>.</small></p>]]></content:encoded>
			<wfw:commentRss>http://coffeebear.net/2007/04/21/dashboard-akismet-hack-003/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>WordPress/Akismet Hack 0.0.2</title>
		<link>http://coffeebear.net/2005/11/24/wordpressakismet-hack-002/</link>
		<comments>http://coffeebear.net/2005/11/24/wordpressakismet-hack-002/#comments</comments>
		<pubDate>Thu, 24 Nov 2005 16:54:01 +0000</pubDate>
		<dc:creator>Mark</dc:creator>
				<category><![CDATA[WordPress]]></category>
		<category><![CDATA[akismet]]></category>
		<category><![CDATA[hacks]]></category>
		<category><![CDATA[spam]]></category>
		<category><![CDATA[WebDev]]></category>

		<guid isPermaLink="false">http://coffeebear.net/?p=407</guid>
		<description><![CDATA[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 [...]]]></description>
			<content:encoded><![CDATA[<p>Do you run <a href="http://wordpress.org/" title="WordPress">WP</a>?  Do you also have <a href="http://akismet.com/" title="Stop Comment Spam and Trackback Spam Â« Akismet">Akismet</a> 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“<sup>1</sup>, I added the following code:</p>
<p><code>&lt;h3&gt;&lt;a href="http://akismet.com/" title="Stop Comment Spam and Trackback Spam Â« Akismet"&gt;Akismet&lt;/a&gt; Stats&lt;/h3&gt;<br />
&lt;? php<br />
$deadspam = get_option('akismet_spam_count');<br />
$livespam = $wpdb-&gt;get_var("SELECT COUNT(comment_ID) FROM $wpdb-&gt;comments WHERE comment_approved = 'spam'");<br />
$sitelink = $wpdb-&gt;get_var("SELECT option_value FROM $wpdb-&gt;options WHERE option_id = '1'");<br />
print "Killed Spam Count: $deadspam\n";<br />
if ($livespam == 0) {<br />
print "Your spam queue is empty!";<br />
} else {<br />
print "&lt;strong&gt;Possible Spam Count: &lt;a href="http://coffeebear.net/wp-admin/$sitelink/wp-admin/edit.php?page=akismet.php" title="Click here to see the moderation queue"&gt;$livespam&lt;/a&gt;&lt;/strong&gt;\n";<br />
}<br />
?&gt;</code></p>
<p>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 &amp; a little patience<sup>2</sup>.</p>
<p><strong>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.</strong></p>
<p><strong>Update:</strong> <a href="http://netocury.com/">Neto Cury</a> 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 <a href="http://wordpress.org/" title="WordPress">WP</a> or one of the plugins I use appears to have changed the first part of the PHP coding from &lt;? php to &lt; ?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 <a href="http://coffeebear.net/wp-content/wpakismethack.txt" title="WordPress/Akismet Hack 0.0.2">here</a>.</p>
<p><strong>Update #2:</strong> Fixed a typo in the previous update.  Sorry about that Neto!</p>
<p><strong>Update #3 2007-04-21:</strong> 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 <a title="Dashboard Akismet Hack 0.0.3 | CoffeeBear.net">here</a>.</p>
<p><sup>1</sup> Blog Stats ends at line 85 in my file and at the time of this writing I am running WordPress 1.5.2.<br />
<sup>2</sup> This is true of every <abbr title="Content Management System">CMS</abbr> that I’ve looked at.</p>
<p><small><a href="http://coffeebear.net/2005/11/24/wordpressakismet-hack-002/">WordPress/Akismet Hack 0.0.2</a> © <a href="http://coffeebear.net" rel="cc:attributionURL">Mark McKibben</a>, <a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/3.0/us/">Creative Commons Attribution-NonCommercial-ShareAlike 3.0 United States</a>.</small></p>]]></content:encoded>
			<wfw:commentRss>http://coffeebear.net/2005/11/24/wordpressakismet-hack-002/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk: basic
Page Caching using disk: enhanced
Database Caching 1/18 queries in 0.024 seconds using disk: basic
Object Caching 632/658 objects using disk: basic

Served from: coffeebear.net @ 2012-02-10 15:10:06 -->
