Gravatars

published

I’ve updated my gravatar plugin to use the new Gravatar REST API. The new API makes it considerably easier for plugins to query the existence of a gravatar, which makes my plugin considerably easier! A few bugs have been squashed, too.

NOTE: this version is called gravatars.php, with an s. If you used a prior version, be sure to deactivate it first, else you’ll have function collisions and your blog will break.

Download the gravatars tarball.
Download the gravatars zip.
Feel free to peruse the README.

INSTALLATION

First and foremost, if you have not yet done so, please fix Bug #902! WordPress versions 1.5.1.1 and above already contain the necessary fix.

Place the gravatars.php file into your wp-content/plugins directory, and activate it. Create the wp-content/gravatars/ directory, if it doesn’t exist – make sure this directory is writable by your web server! Click the Options link in your admin menu, select Gravatars, and set the default options. If you enable local gravatars, click the Users link in your admin menu, select Gravatar, and define a local gravatar image for yourself, if you want one.

Edit your theme’s style.css, and add two new definitions:

.gravatar {
        float:left;
        padding: 3px;
        border: 1px solid #000;
        background: #fff;
}

.postgrav {
        float: left;
        padding: 3px;
        margin-right: 5px;
        margin-left: 5px;
        border: 1px solid #000;
        background: #fff;
}

note: these are the CSS declarations may not work for you. You may want something different.

Edit your theme’s comments.php file, like this. We wrap the entire thing inside an if (function_exists(‘gravatar’)) { block to make sure your site doesn’t totally break if you disable this plugin for some reason.

USING GRAVATARS

Commenters who have registered for a gravatar will have their gravatar image displayed next to their comments. Anyone who has not yet signed up for an account will receive the gravatar image you defined in your Options page. Registered users who have assigned themselves a local gravatar will automatically have that image assigned.

<gravatar skippy@skippy.net />
You can insert a gravatar into any post or page with a simple tag: <gravatar skippy@skippy.net />. If the email address you supply does not have a gravatar, your default gravatar image will be used, instead.

CHANGELOG

2005-07-02: released version 2.6, adding an ALT attribute to the gravatar images used in posts. Thanks Mike for the heads-up. 2005-07-02: released version 2.5 (skipping 2.4). This version should fix random gravatars 2005-06-20: released version 2.3 (skipping 2.2). This version fixes the &s in the links when used to fetch images from gravatar.com -- thanks Gregory! Also included in this version is support for random default gravatars. Thanks to Shane for the impetus and testing. PLEASE read the updated documentation for details on how to use random gravatars. Also note that I am no longer offering or supporting one-click installs through the WP Plugin Manager. 2005-05-21: released version 2.1. This contains a minor, but important, fix for handling allow_url_fopen. The plugin now uses ini_get instead of get_cfg_var, which should avoid some false positives that had been occuring. Thanks to Fredo for a German translation! 2005-04-21: released version 1.9. Minor fixes for valid XHTML (thanks frozenstar) and local gravatar handling (thanks kiesow). This version also introduces support for localization of the text used in the administrative interface. Included in the archive is /wp-content/gravatars/gravatars.po, which you can use to translate the text as needed. Feel free to send translations to me, and I'll make them available for download. 2005-04-05: released version 1.8. The plugin now checks for the value of the server's allow_url_fopen setting. If disabled, the plugin automatically disables caching gravatars. Updated the caching and looping, to hopefully improve performance. On some servers (like mine!), this plugin can introduce noticable delay. If that bothers you, simply disable caching and all gravatar images will be pulled from gravatar.com. (Note: this plugin is designed to make gravatars more reliable, not necessarily faster!) Updated comments.php template to properly assign gravatars to trackbacks and pingbacks. 2005-04-02: released version 1.6, with special thanks to Adam for fixing a bug with how image sizes are handled. 2005-03-29: released version 1.5, which significantly improves options storage in the database. Also introduces a new cache expiration verification method using the database, instead of the filesystem.

home / about / archive / RSS