Gravatar Hack

I've always been a big fan of gravatars. I dont know im just a sucker for little images representing people. anyway for those of you who dont know what they are, check out

For those of you who do, and want to have alittle hack to plop them into your comments, here is an easy one line hack to do it.

go to image.php in your theme, and if its the default theme go to around line 49, or just look for <div class="commentmeta">, and plop the following line of code right after that (make sure its the first one).

<?php $grav_email=getCommentAuthorEmail(); $grav_url = "".md5($grav_email)."&default =".urlencode($default)."&size = 80"; echo "<img src="$grav_url" alt=" " class="gravatar">" ; ?>


this will give you an 80x80 image styled with the css class gravatar. Now just style it and you're done :)

Here is some css you could use in your zen.css
.gravatar {
width: 20px;
border: 1px grey solid;
padding: 1px;
vertical-align: middle;

here is an example of what it looks like:

p.s. As you can see this is pretty easy to impliment. if we ever do get a plugin setup going, i would love to make a plugin for this.


Sign In or Register to comment.