spam-o-rama

I’d missed the news, but the latest version of the Akismet plugin for WordPress includes some tasty stats. As with all things statistical, there’s a few ways to read the numbers, and there are some anomalies (ferinstance, it claims I had a few days of over 1000 ham i.e., valid comments per day and that’s just plain wrong) but the spam stats feel roughly right. They’re not dramatically different from what I was seeing under Mollom, except nobody gets inflicted with Captcha using Akismet.

Akismet history graph
Akismet history graph

User Avatar Photos in WordPress

WordPress has supported Gravatars for awhile, which is great, but if you’re rolling out a site for a bunch of students to hammer on, it’s not ideal to have to send them to a third party service to set up photos. It’s awkward, and confusing, for new users to have to go somewhere else to add a photo to their profile. And profile photos can be very useful, especially at the beginning of a semester when everyone is just getting to know everyone else in a class, to put a face to a name.

So, for UCalgaryBlogs.ca, I just installed the handy User Photo plugin. Now, any site can enable this, and the users of that site will be able to add photos to their profiles, like this:

The plugin can be configured with custom sizes for the full-size and thumb versions of the avatar, and the avatar image can be deleted and/or replaced at any time.

It’s not completely trivial to enable – because the themes need to be User Photo aware. That’s pretty easy to add, though. For the cutline theme we’re using on a project, I edited a handful of files to add the code, and it works great. On index.php, and single.php, just add this wherever you want the blog author’s photo to be displayed on the post (I put it in the section displaying the post meta information):

<?php if (function_exists('userphoto_the_author_thumbnail')) {  userphoto_the_author_thumbnail();}?>

Wrapping the thumbnail display code in a function_exists conditional means it will degrade nicely if the plugin is unavailable. Always a good thing to degrade instead of borking.

That results in this display when viewing the post:

Now, if you also want to show avatars on the comments, just edit comments.php to add this code (I put it in the comment meta info section):

<?php if (function_exists('userphoto_comment_author_thumbnail')) { userphoto_comment_author_thumbnail();}?>

And that will look like this when displayed on the blog:

If a user hasn’t added an avatar, it won’t display any image. But if they do have one, they’ll get the properly sized version of their avatar image displayed automatically. Easy peasy. It’s a bit awkward having to edit the themes, but it’s not difficult. The hard part will be remembering to re-apply the edits if the themes get updated (hence this post…)

Yahoo! Shortcuts!?

Jim posted about Yahoo! Shortcuts, and while the WordPress plugin sounds cool (it claims to scan a blog post and automagically find links to blog posts, flickr photos, and other sources of info), I’m not sure how well it’ll translate into real life. It looks like it scans the blog entry as you’re writing it, and when done it’ll run some code to insert stuff into the post before publishing.

I’m wondering if this is like StructuredBlogging with some automated lookups. How does the output look? Is this something worth using? How accurate is the logic for finding relevant links and photos? I’m just going to leave this post however Yahoo! Shortcuts generates it, as an example. And maybe to get the free t-shirt…

Jim raises a very important point – is this just a tool to embed content from Yahoo! endeavors? Will we be able to add other sources? Automatic lookups of Wikipedia pages? IMDB lookups? Or, is this just a tool to increase the Google Juice of Yahoo! properties?

So far, it looks like it just inserts hyperlinks around some predefined keywords, and points them to Yahoo! search pages. Not very useful, and something I find very annoying on the big sites that use this strategy. A link should point to a page, not a generic query. Anyone can do a search for a keyword without having these blasted hyperlinks inserted all over the place, with their annoying pop-in preview windows. Ick.

Update: wtf? looks like it uses javascript to embed the links and content. so the content doesn’t really exist, and the links don’t really mean anything from the perspective of search engines etc… this isn’t an intelligent structured blogging at all, it’s a javascript insertion. don’t like that one bit… And for some reason it’s adding the span tag several times for some of the identified keywords. Think I’ll be disabling this plugin. It’d be pretty cool if they released the cool CC Flickr photo finder as a separate plugin, perhaps with a more fully-featured Flickr photo inserter function…

Simple Tags – Tag Autocompletion in WordPress

When I switched from Drupal to WordPress as the software that runs my blog, one of the things I missed was tag autocompletion while writing posts. Drupal has a great freetext tag field, including an AJAX utility that automatically checks with the server for tags that match what you’ve started to type in the tags field.

And now, WordPress has that too! With the Simple Tags plugin. It has some other features, too (but I haven’t tried them yet) but the tag autocompletion is killer. Why isn’t that included in a stock WP install?

Here’s what the autocompletion offered as I entered the tags for this post:

SimpleTags Autocompletion

WordPress Super Cache

I’ve been using the WP-Cache 2 plugin for some time, as it offers pretty effective file-based caching of WordPress pages to help reduce the load on the database server and reduce page generation time. But the plugin has kind of languished without any real updates for months(?) or years(?).

Donncha O Caoimh, the WordPress guru who’s name I’ll never be able to pronounce, released an updated and refined caching plugin called WP-Super-Cache, based on the great start offered by WP-Cache 2.

Traditionally, if someone wanted to run a high-performance weblog, or an enterprise-level weblogging system, they really had only 2 choices.

  1. MovableType – because it generates static HTML for every page of the site, and only runs code when posting new content (posts or comments). It can, in theory, scale pretty much infinitely, but can also take for fracking EVER to publish content because it may have to regenerate static files for EVERY page on the site (if you change the theme, you get to create 5,000 new .html files to reflect it).
  2. WordPress on some bad-ass hardware. WordPress.com runs on it, but they use 23 bajillion servers, with jaw dropping MySQL clustering and replication. Dynamic content with query caching, etc… Works great, but needs a fair bit of care on the back end to manage the tiers of MySQL (or Oracle?) database servers, and multiple webservers.

Now, there’s a pretty kickass third option.

  1. WordPress on commodity hardware, with WP-Super-Cache

WP-Super-Cache does some great caching, storing the output of dynamically generated pages, and returning those rather than hitting the database. It doesn’t even have to fire up PHP to spit out the cached pages – it’s essentially running as a static file server. Kinda like MovableType. But with lazily bound cache that gets regenerated as needed. You don’t have to staticize an entire website, just the pages that are being requested. And they’re updated every hour or so, so the load on the server should be extremely low.

If your server is kosher, it’ll also gzip the cached pages, saving disk space, time and bandwidth (sadly, neither of my servers seem to play nicely with the gzip “super cache” option – I’ll play more later).

Now, my blog likely still won’t survive a full-on Slashdotting because I’m running on an inexpensive shared hosting provider (Dreamhost). But it should survive a pretty respectable amount of traffic (i.e., way more than I currently get) so I should be good to go. And ucalgaryblogs.ca should be able to serve out some pretty decent traffic loads, assuming I manage to actually market it and get folks to use it…

WP-Super-Cache also works out of the box on WordPress MultiUser. It installs as a mu-plugin with minimal effort, once you RTFM. The options, oddly, don’t show up in “Site Admin” but in the “Options” panel on the main blog of a WPMU installation.