WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Comment author name/gravatar link works for visitors but not me (21 posts)

  1. theobroma
    Member
    Posted 4 years ago #

    Hi all,

    I'm using the WP-Gravatar plugin for gravatars on my site.
    When someone leaves a comment, their name and gravatar link back to their site (if URL info entered).
    However, when I leave a comment on my own site, either when logged in or logged out, my own name and gravatar do not display a link back to my site, despite having entered the URL information.

    My discussion settings are set to enable gravatars and link to author's site.
    So I don't understand why it works for visitors but not for me.

    Any ideas and suggestions much appreciated.

    An example is here.

  2. esmi
    Forum Moderator
    Posted 4 years ago #

    Do you have a gravatar account? Are you using the same email address on your site that you used for your gravatar?

  3. theobroma
    Member
    Posted 4 years ago #

    Thank you Esmi, I do have a Gravatar account, and I had registered my website address on it, but it wasn't set as my "primary" email address. I just changed that and thought it was fixed....
    But it only works if in WP-Gravatars settings I check the box that says "Gravatars and name for users with no given blog/url link will be linked back to: www. mysite.com"

    I'd rather not enable that option, but if I uncheck that box, I'm back to no linking for my own name and gravatar.

  4. esmi
    Forum Moderator
    Posted 4 years ago #

    Have you tried not using the WP-Gravatars plugin?

  5. theobroma
    Member
    Posted 4 years ago #

    Yes, orginally I didn't use it, but Gravatars weren't showing up at all. Maybe I should deactivate WP-Gravatars and try again.

  6. esmi
    Forum Moderator
    Posted 4 years ago #

    I've not had any problems with using the default gravatar settings in Settings/Discussion.

  7. theobroma
    Member
    Posted 4 years ago #

    Thank you, that's helpful. I'm going to remove this plugin and try the default settings once again.

  8. theobroma
    Member
    Posted 4 years ago #

    I deactivated WP-Gravatars, then checked to make sure avatars were enabled in the discussion settings, including identicons for users with no avatars, but now no avatars/gravatars are showing at all, as before....

  9. theobroma
    Member
    Posted 4 years ago #

    Just looking at the codex and it says some themes are not gravatar-enabled. I suspect that may be the case with theme I'm using, ProSense.

    The doc says this calls the Gravatar:

    <?php
    echo get_avatar( $id_or_email, $size = '96', $default = '<path_to_url>' );
    ?>

    But I have no idea where to put it, and whether I need to add any other code elsewhere.

  10. theobroma
    Member
    Posted 4 years ago #

    Just noticed that the gravatars show up alongside the edit comments area in the dashboard, just not on the comments following the actual posts...

  11. theobroma
    Member
    Posted 4 years ago #

    For anyone having the same problem, I found some useful instructions on how to enable gravatars here:

  12. theobroma
    Member
    Posted 4 years ago #

    Gravatars are now showing, and names are linking, but the gravatar images themselves are still not linking to the authors' websites.

    Does anyone know how to enable gravatar image linking?

    I've posted my comments.php code here.

  13. esmi
    Forum Moderator
    Posted 4 years ago #

    How about:

    <?php if(function_exists('get_avatar')) { echo '<a href="' . get_comment_author_link() .'">' . get_avatar($comment, '40') .'</a>';} ?>

  14. theobroma
    Member
    Posted 4 years ago #

    Thanks Esmi... I've just inserted that code - there's some linking happening, but it's not to the author site, rather to the author URL appended to the page URL.....

    Maybe I didn't insert it correctly. I replaced this line:

    <?php if(function_exists('get_avatar')) { echo get_avatar($comment, '40'); } ?>

    with the code you provided.

    Here's where the link on a gravatar leads to:

    http://www. mydomain.com/page/%3Ca%20href='www. authorsite.com'%20rel='external%20nofollow'%20class='url'%3Eauthorname%3C/a%3E

  15. esmi
    Forum Moderator
    Posted 4 years ago #

    Oh - that's weird. I'm using get_comment_author_link() on one of my sites to link the commentator's name back to their site and it works fine. It should have worked with your gravatar image too. Sounds you did add it in exactly the right place too.

    Do you have other plugins installed? Can you post a link to a page with this on?

  16. theobroma
    Member
    Posted 4 years ago #

    Here's a link to a page with some comments where you can see what's happening.

    I have other plugins installed (22 of them), but no other gravatar or comments plugins.

    These are the plugins I'm using.
    AddtoAny, Advanced Excerpt, Akismet, All-in-one-SEO, Better Blogroll, Category Posts Widget, Contact Form ][, Frame Buster, Google Analytics, Google XML Sitemaps, Maintenance MOde, Page Excerpt, Page Lists PLus, Page Tagger, RSS Footer, RSS Icon Widget, Stray Random Quotes, TS Custom Widgets, WordPress Stats, WP-CMS Post Control, WP-Print, WP-Super Cache

  17. esmi
    Forum Moderator
    Posted 4 years ago #

    Try:

    <?php if(function_exists('get_avatar')) { echo '<a href="' . get_comment_author_url() .'">' . get_avatar($comment, '40') .'</a>';} ?>

  18. theobroma
    Member
    Posted 4 years ago #

    Esmi, that works perfectly. Gravatars are linking to authors' websites. Thank you so much!

    The identicons of users who did not enter a website URL are still linking back to the page, but perhaps that is the default?

  19. esmi
    Forum Moderator
    Posted 4 years ago #

    The code can be tweaked a bit further to prevent any link being generated when there isn't a web site url.

    <?php if(function_exists('get_avatar')) {
    	if( get_comment_author_url() !='' ) echo '<a href="' . get_comment_author_url() .'">' . get_avatar($comment, '40') .'</a>';
    	else echo get_avatar($comment, '40');
    } ?>
  20. theobroma
    Member
    Posted 4 years ago #

    That's perfect!

    Many thanks for your help with this!

  21. edgars12258
    Member
    Posted 4 years ago #

    Esmi, that worked for my garte "
    <?php if(function_exists('get_avatar')) { echo '' . get_avatar($comment, '40') .'';} ?>"

    Super Bro ! ! ! :)

Topic Closed

This topic has been closed to new replies.

About this Topic