As previously mentioned, I’ve been working on updating and customizing the VectorLover WordPress theme to include some of WordPress 2.7’s new features and to integrate with certain WordPress plugins which I like. This evening I’m happy to announce the initial release of VectorLover 2.


  • Threaded comments with quick reply links.
  • Integrated plugin support for: Now-Reading, FAlbum, Tweetbacks, wpLicense
  • Custom login page
  • Added a new default Gravatar image to list of options under Settings -> Discussion in WordPress’s admin backend.
  • hCard microformatting to both post & comment authors.
  • A stylesheet to remove unnecessary elements from printed pages.
  • Changed page titles to display as “PostTitle « BlogName” vs the previous “BlogName » PostTitle” for better SEO
  • Wrapped posts in a DIV with post_class() to add support for fancier styling on posts.

Special Thanks

This release would not have been possible without Erwin Aligam — who designed the initial theme, ThemeLab — who ported the design to WordPress, famfamfam — designed some wicked-nice icons or any of these sites:,, and — all of whom provided valuable information while I was working on this release.


You can download this release from my VectorLover 2 page.

Dashboard Hack 0.0.3

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 great1 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 hack to display those moderation numbers, when I upgraded my site to a more current version of WordPress my hack broke.

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:

  1. Download a copy of the Akismet plugin for WordPress
  2. Decompress the zip file
  3. Open the akismet.php file in your favorite text editor2
  4. In akismet.php, search for “function akismet_stats()”. It should be around line 510.
  5. In the akismet_stats function, under the line reading echo '<h3>'.__('Spam').'</h3>'; add the following 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";
  6. Save your changes.
  7. Uploaded your edited copy of akismet.php to and then follow the normal instructions for installing/activating the Akismet plugin.

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 here.

Update 2007-04-22: 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!

1 Particularly with the Bad Behavior anti-spam plugin added to it.
2 E.g. Kate

As part of my upgrading to the latest/greatest version of WordPress, I switched over to using the Now Reading plugin from AMM. I switched because development on AMM seems to have come to a complete halt and it was acting somewhat flaky prior to the upgrade. One of the big problems with switching over was I didn’t want to have to manually enter in all books I’d already read and rated. As Now Reading supports storing so much more data, I had to write a bit of custom SQL to import my existing info. It’s not a great solution, mostly because AMM didn’t store all of the same info (e.g. date entered, started and finished).
INSERT INTO wp_now_reading(b_added, b_started, b_finished, b_title, b_nice_title, b_author, b_nice_author, b_image, b_asin, b_status, b_rating, b_review)
SELECT amm_dateadded, amm_dateadded, amm_dateadded, amm_title,
REPLACE(REPLACE(LCASE(amm_title), ',', '' ), ')', '' ), '(', '' )
, ' ', '-' ), '...', '-' ), ':', '-' )
, '!', '-' ), '?', '-' ), '&', '-' )
, '\'', '' ), '--', '-' ), amm_author, REPLACE(REPLACE(REPLACE( LCASE( amm_author ) , '.', '' ) , '&', 'and' ) , ' ', '-' ), amm_smallImageURL, amm_asin, 'read', amm_rating *2, amm_userComments
FROM wp_amm amm
WHERE amm_ProductGroup = 'Book' AND amm_asin NOT IN (SELECT b_asin FROM wp_now_reading);

This short script copied over all my books for me and got everything setup as well as could be expected given the differences in the data. Below is a list of the assumptions I made in writing this script to convert to Now Reading:

  • AMM only stores one date, so I used that for all dates on the books I copied over.
  • The above script limit itself to books and skips any already in your wp_now_reading table.
  • Now Reading has additional fields the title & author. I’m not sure what the “b_nice_author” field is used for, but the “b_nice_title” is used when you go to edit a specific book. The format of the “b_nice_” fields seems to be to replace anything other than a letter or a number with a hyphen and to have all the letters be lower case. I tried to make sure I did the same with my script, however you may need to double-check your data before running this to make sure I didn’t miss a symbol you used.
  • I marked all the books I was copying over as “read”.
  • AMM only allowed ratings of 1 – 5; while Now Reading allows 1 – 10. So when I copied the ratings over, I doubled them.

NOTE: If you have questions about this script, post them in the comments here. Keep in mind that I’m not providing full fledged support for the script and if you don’t know how to run this without asking, then you probably shouldn’t be messing with it. Also, if you’re really going to try running this script, then for god’s sake backup your database FIRST!

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="" 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="$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.


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.