WordPress.org

Ready to get started?Download WordPress

Forums

Gravatars and threaded comments (15 posts)

  1. Jaxia
    Member
    Posted 8 years ago #

    Hello -

    I'm trying to figure out how to use gravatars on my site. I know I'm supposed to put this line: <img src="<?php gravatar() ?>" alt="" /> somewhere, but where? I'm using Brian's threaded comments, so I have a comments.php file in my theme. Anybody know where it goes within that file? Do I need to put it in more than once?

    Thanks!

  2. yuh
    Member
    Posted 8 years ago #

    the same here. i really don´t know how this could work....we have the same prob...hope someone can help us soon. gravatar is needed :) !!

  3. skippy
    Member
    Posted 8 years ago #

    You place the <img src="<?php gravatar() ?>" ... > somewhere inside the comment loop.

    This example might help. The example is just that -- an example -- and probably won't work if you simply copy and paste.

  4. Jaxia
    Member
    Posted 8 years ago #

    <i>somewhere inside<i>

    Heh. That's the problem. There is so much going on in the comments.php file for threaded comments that I cannot figure out what it takes. The if's and else's are more than my brain can figure out! :)

    Does the example use threaded comments, too? Thanks for posting it!

  5. skippy
    Member
    Posted 8 years ago #

    No, my example does not use threaded comments.

    The list of comments is displayed by use of a "foreach" loop, which starts with this line:
    <?php foreach ($comments as $comment) :
    Then, inside each iteration of this loop, each comment's data is displayed. You'll want to place your gravatar image declaration somewhere inside this foreach loop, which ends with this line:
    <?php endforeach; ?>

  6. Jaxia
    Member
    Posted 8 years ago #

    I cannot find that loop within the comments file. I even did a "find" on it.

  7. skippy
    Member
    Posted 8 years ago #

    line 31 of Brian's Threaded Comments declares a function called "write_comment()", which is used to display one comment. This function is called repeatedly, as long as there are comments.

    You will want to insert your gravatar image declaration in there, somewhere.

  8. Jaxia
    Member
    Posted 8 years ago #

    I figured it out:

    I put this
    <img src="<?php gravatar("", 20) ?>" alt="" />

    below this line:
    <img class="collapseicon" src="<?=get_settings("siteurl")?>/wp-content/plugins/briansthreadedcomments.php?openedthreadimage=true" onclick='collapseThread("div-comment-<?php comment_ID() ?>")' />

    above this line:
    <?php comment_author_link() ?></cite> Says:

    You can see it here:
    http://www.stealtheblinds.net/2005/05/15/step-right-up/#comments

    Skippy - Thanks so much!
    I hope this helps someone else!

  9. yuh
    Member
    Posted 8 years ago #

    YES IT DID!!!! thx. that was an easy tut for a dump!!! like you, erm yuh.. :)

    fine fine now everything´s clear. thx

  10. Sproke
    Member
    Posted 8 years ago #

    So how do you do this with normal comments in 1.5.1.2? I'm having trouble where to put the lin

    <?php gravatar("R"); ?>

    Cheers
    Sproke :0)

  11. ensellitis
    Member
    Posted 8 years ago #

  12. skippy
    Member
    Posted 8 years ago #

    Can we call this thread resolved now? Or do you still need assistance?

  13. clay
    Member
    Posted 8 years ago #

    Hey--

    I am using the threaded comments plugin and Skippy's gravatar plugin

    and I have everything working except when using the theaded comment template, local avatars are seemingly ignored and only the blank avatar is shown.

    I am using this code to invoke it:

    <div id="div-comment-<?php comment_ID() ?>" class='comment <?php echo $oddcomment?>'>
    <a name='comment-<?php comment_ID() ?>' id='comment-<?php comment_ID() ?>'></a>
    <cite>

    <?php if (function_exists('gravatar')) {
    if ('' != get_comment_author_url()) { ?><a href="<?php comment_author_url(); ?>" title="Visit <?php comment_author() ?>">
    <?php } else { ?><a href="http://www.gravatar.com"> <?php } ?><img src="<?php gravatar($comment->comment_author_email); ?>" alt="Get your own gravatar for comments by visiting gravatar.com" class="gravatar" />
    </a>
    <?php } ?>
    <?php comment_author_link() ?></cite> Says:
    <?php if ($comment->comment_approved == '0') : ?>
    <em>Your comment is awaiting moderation.</em>
    <?php endif; ?>

    Any ideas? If I use the standard template the local avatar shows up..

  14. clay
    Member
    Posted 8 years ago #

    bump

  15. clay
    Member
    Posted 8 years ago #

    OK-- after getting some sleep I have seemingly figured out what was wrong:

    <?php if (function_exists('gravatar')) {
    if ('' != get_comment_author_url()) { ?><a href="<?php comment_author_url(); ?>" title="Visit <?php comment_author() ?>">
    <?php } else { ?><a href="http://www.gravatar.com"> <?php } ?><img src="<?php gravatar(get_comment_author_email()); ?>" alt="Get your own gravatar for comments by visiting gravatar.com" class="gravatar" />
    </a>
    <?php } ?>

    This appears to be working

Topic Closed

This topic has been closed to new replies.

About this Topic