Warning :
This plugin was developped a long time ago, and I stopped working on it. It’s not compatible with recent versions of ZenPhoto, and I don’t plan on making it work again.
Presentation :
Gravatar for Zenphoto is a really simple plugin allowing the use of Gravatar avatars in comments. Here is what it looks like in my own gallery (click on the image for a larger view) :
How to use it :
The plugin provides only one function : get_gravatar(&email, &size). The first parameter is the email of the comment author and the second parameter is the size of the avatar image. To use gravatars in your gallery, simply edit your image.php file, and print the return of this function. For example, in my gallery, it’s used like this :
echo get_gravatar(getCommentAuthorEmail(), 40);
It will print something like this :
<img class="gravatar"src="http://www.gravatar.com/avatar.php? gravatar_id=c590348e48a0993a7d79039df08da6c0&size=40" />
The gravatar image is using the css class “gravatar” so that you can customize how it looks via your css file.
In version of Zenphoto earlier than 1.2.6, the comments were handled in the image.php file of your theme by something which looked like :
while (next_comment())
{
....
}
So, up to version 1.2.5, you simply have to locate the “while (next_comment())” loop, and inside it, add the following line :
print(get_gravatar(getCommentAuthorEmail(), 40));
But, since 1.2.6, their was a few changes to the way comments are handled. It’s now handled by a plugin, so the loop displaying the comments have moved to the file : zp-core/zp-extensions/comment_form.php
You can edit this file, and there you will find the “while (next_comment())” loop where you can use the get_gravatar function. It’s a dirty way, but it works until I find a proper way to make this plugin work.
Bugs :
I’m developping this plugin mainly for my own use, so I don’t test it in other version of Zenphoto (currently using the 1.2.6) I also don’t test it in Zenphoto installations with other options (I use URL rewritting, etc.) So their might be a few bugs. If you are using this plugin and experiencing any kind of problems (bug, a feature that is missing, etc.) you can post a comment here, or use the Contact page to send me a more detailed mail.
Changelog :
v0.1:
- Added: get_gravatar(&email, &size) Function to get the <img /> tag containing the gravatar for the given email, at the sepcified size in pixels.