gravatar for b2
January 13th, 2005
sorry, i removed my implemenation because it slows down my comments form loading time too much.
if you wish to implement gravatar for b2, here’s how to do it. since i no longer have a copy of b2, i looked at Lissy’s code.
open either b2comments.php or b2commentspopup.php depend on which one you are using
and find the line:
$commentdata = get_commentdata($rowc->comment_ID);
add below:
// just leave it blank if you don't want to use a default avatar image
$default = "http://yourdomain/default_avatar_image.gif"; // the size of your avatar. in this case, it is 40x40.
$size = 40;
$grav_url = "http://www.gravatar.com/avatar.php?gravatar_id=". md5($commentdata['comment_author_email']). "&default=".urlencode($default)."&size=".$size;
add the line below whereever you want your avatar to show up in your comment:
<a href="http://gravatar.com/" title="Get your gravatar at gravatar.com"><img src="<?php echo $grav_url; ?>" alt="Get your gravatar at gravatar.com" /></a>
if you use my threaded comments hack, you need to do similar things for my dodos_thread function in b2functions.php
6 Comments Leave a Comment
January 14th, 2005 at 12:12 amI LOVE YOU DODO!!!!!!!!!!!
I have tried all weekend to make it work for b2. :-( You are my saviour! :-D
Works really well Dodo, here, I will try to add it to your threaded comment hack now. I will be back if I find something out of course. :-) By the way, I knew where I have seen Misty before, at the Osbournes! Your little one is famous! :-D
Ok, done. :-) Adding the hack to b2functions really shouldnt be a problem for anyone, as it is EXACTLY the same as above. Works wonderfully!
Wow this had to come as soon as I switched to wordpress lol! Awesome Dod =D Why did I not visit this site before x_x I am loving it!
[...] to bed for me! Be sure to upload your own Gravatar so it will show up when you comment. Thanks to Dodo for the Gravatar for b2 hack (check out her site for more details). [...]


Works just fine!