Installation Instructions

INSTALLATION

Installation instructions are mostly the same as Skippy’s version (copied here for your reference), but has a different directory & file structure that must be set up:

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.

VERY IMPORTANT: If you have another gravatar plugin installed (e.g. Skippy’s version), then you must deactivate and/or delete it before installing this plugin. They are not compatible, and will conflict with each other.

Unzip the Gravatars2 package in the WordPress root directory. This will place all of the necessary files into their proper directories (and create the necessary directory structure for storing cached gravatars). (Optionally: manually create the directory structure included in the tar/zip file, and manually copy each file into its proper place.) Make sure the ./wp-content/gravatar/* directories are writable by your web server!

In the Plugins screen, activate the Gravatars2 plugin (and optional WP-Cron & Gravatars2-WPCron plugins). Click the Options link in your admin menu, select Gravatars, and set the default options. Unless you have a good reason not to, the “Cache Gravatars” option should be set to “Yes”. 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. Here is what this site is using. (Gravatar styles at the bottom of the style.css file.)

Edit your theme’s comments.php file and add the folowing inside the “comment loop”:

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

For example, here is what this site is using. 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.

CRON CONFIGURATION
(optional, but HIGHLY recommended)

Use the System Cron option if possible, otherwise use the WP-Cron option:

System Cron:

  • add the following cron job:
    0 * * * * /usr/bin/php /full/path/to/wordpress/gravatars2-cache-refresh.php >/dev/null 2>&1
    • “gravatars2-cache-refresh.php” included in download package — must be installed in the WordPress root directory
  • Recommended: run system cron hourly — e.g.: 0 * * * * ...
    • Optional: Change the 0 in the cron job to some other minute to offset other cron jobs on your server (and other servers running Gravatar2 cron jobs)
  • WordPress plugin CronMonkey can be used for easy system cron configuration
    • Note: the “Advanced Crontab Manager” inserts a Win/Dos ^M at the end of the lines, so breaks Unix-based system cron jobs — use the Simple manager or edit from shell
  • Set Gravatars2 “Auto Check Cache” option to “Disabled” (so gravatar cache is ONLY checked by the system cron job, NOT by users browsing your site)

WP-Cron:

  • Install & Activate Skippy’s WP-Cron plugin
  • Activate Gravatars2-WPCron plugin (included in Gravatars2 zip package)

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.

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