Support » Requests and Feedback » Using Gravatars in Recent Posts

Viewing 15 replies - 1 through 15 (of 17 total)
  • I guess my question wasn’t clear enough: I’d like to integrate gravatars in the recent-comments-plugin.

    If you have the “gravatar” plugin installed you should be able to use the gravatar tag from within the recent-comments plugin.


    I’m not quite sure how. Do you know how to do this ?

    In your recent-comments plugin, you should have the variable $comment within the FOREACH loop. At that point in time, you should als have access ot the commenter’s email access by way of $comment->comment_author_email.

    You can then take that call Gravatar’s website directly with:

    $out = "".md5($comment->comment_author_email);
    echo $out;

    This should get you the gravatar. Give it a shot and lemme know if you need any help debugging it.



    First of all, I’d like to say I’m a PHP-newbie, and therefor not quite sure were to put the code you suggested. Second of all, I’d like to influence the size of the gravatar (10×10) . If that’s not possible, the suggested solution isn’t worth implementing.

    @7seconden : you could at least READ the links that Cypher provided. Your second question is specifically covered :

    Usage: gravatar has the following syntax:

    <?php gravatar({rating{, size{, default{, border}}}}) ?>

    All of the parameters are optional. For example, the following will create a gravatar URL that allows all rating levels, is 80×80 pixels, uses no default image, and has no border:

    As for your first question, Cypher did answer to it in his last message. What is it that you don’t understand ? The procedure is quite clear, but let me make it even clearer :

    1. Open your recent-comment.php file. I’m not sure this file exists, it’s author website is down so I don’t have access to the file. Anyway, open every file you lately uploaded to your server to activate the recent-comment function, until you…
    2. Locate this function : $comment->comment_author_email, then…
    3. Proceed pretty much the same way you did with wp-comment.php (that works already well on your website).

    And then that should work.

    This is the thing – the procedure is not clear.

    Pointing people to the Gravatar Website for instructions is pointless, since it doesn’t tell us WHERE to put the code.

    Specific instructions on where to put the code and in what files shouldn’t be that difficult to find, and yet – here I am.

    I don’t know what the “Comment Loop” is or where to find it, but that’s okay – I’ll just figure it out and when I do, I’ll post clearer instructions so new people don’t have the same hard time I did.

    Thanks anyway.

    @penda: I hope you can figure it out. I’ve allready bookmarked this topic.

    I started this but gave up, my php skills are lacking. But this works somewhat, maybe someone could clean the code up and fix it. It’s the myhacks.php version of recent comments and some code christjdavis gave me combined.

    I’m not sure how to limit the amount of text shown for each comment, but other than that I think it woks. Add it to myhacks.php

    I’ve only recently regged with a gravatar and though I haven’t implemented it into my site, the clarity of the instructions are pretty lacking. I’ve seen many people post the link to the instructions of how to install it – however, it lacks instructions on WHERE to install it.

    There have been several posts like this, and I think it’s something that perhaps requires a touch more explaination and less berating.

    the instructions are:

    A plugin is available for WordPress 1.2 installations. The plugin makes available a tag called gravatar that, when used inside the Comment Loop, outputs the correct gravatar URL based on the commenters email address.

    Well, now call me stupid but if a user with no understanding of the comment loop is given that he can only assume it’s within the comments.php file – where exactly? Who knows? Clear instructions are better than several posts asking the same question, and several replies sending them back to the link on the gravatar site. That would be called the reply loop would it?

    This is the Textpattern instruction:

    Installation: Find and open the file at <TextPattern Install Dir>/publish/comment.php. Scroll down to line 126. You want to enter the line below that is in bold

    Now THAT is clear – it tells you where to past the info SPECIFICALLY. The only time questions would arise is if they get an error due to some other factor, in which you couldn’t blame the instructions. With WP it’s a different matter, and quite the opposite.

    This is more of a how to add gravatar to “Recent comments” plugin, that usually shows in the sidebar of the main page, listing maybe 5 of the newest comments.

    @ Damon: Correct! The original question was how to implement gravatars in the recent comments plugin. Not how to install it! I want this plugin to use the gravatar functions. Can anybody help?

    7seconden a couple posts above i posted a link to myhacks.php that adds gravatars to recent comments.ust drop it into your blog root and make sure “use myhacks” is enabled in your admin, then add the include to your sidebar or wherever you want them to appear.

    thng is, it needs work. thats why i posted it, i cant do anymoe with it.

    btw, the top of this is adding gravatars to recent posts, not recent comments :p

    I’ve seen this working great at

    on the sidebar. Maybe he can shed some light on this. I would like this feature as well.

Viewing 15 replies - 1 through 15 (of 17 total)
  • The topic ‘Using Gravatars in Recent Posts’ is closed to new replies.