WordPress.org

Ready to get started?Download WordPress

Forums

User avatars in comments (11 posts)

  1. r3bb
    Member
    Posted 4 years ago #

    Hi,

    I recently installed Adam Hupp's WP-fbconnect plugin and it's working fantastic, except for one problem: I can't seem to get the user avatars to play nicely with the default ones in WordPress.

    When a user is signed into facebook and leaves a comment on the blog post, the plugin should use their facebook profile picture as their avatar. I can get this to work if I insert the following code where I want the facebook avatar to display:

    <?php echo get_avatar( $comment, 32 ); ?>

    Unfortunately, the default WordPress avatar shows also. So I end up with 2 different avatars for each comment, which looks really bad. There is a setting in the WordPress discussion settings panel that lets me choose a blank avatar, but the width of that avatar still pushes the user's name over to the right, which creates an empty space between the post number and the user's name.

    Can anyone tell me how to turn on avatars but use an avatar that has a pixel width of 0 or 1? That might do the trick.

    Thanks,

    -r3bb

  2. r3bb
    Member
    Posted 4 years ago #

    For reference, my blog is located at http://www.darwinspet.com/blog

  3. alism
    Member
    Posted 4 years ago #

    Isn't there a 'don't show avatars' option on the same page?

  4. r3bb
    Member
    Posted 4 years ago #

    Yes, but when I check that option, it suppresses all avatars, even the ones from facebook.

  5. alchymyth
    The Sweeper & Moderator
    Posted 4 years ago #

    it may help, if you post a link to a post with comments, where the two avatars show, so we can check if they are styled by different tags, or if not.

    to suppress the 'wordpress' avatar, you could add 'display:none;' to the respective style in style.css:

    #comments-list .comment-author img.avatar {
    	float: left;
    	margin-right: 0.5em;
      display:none;
    }

    or are you asking for a conditional code: if facebook avatar: show this and no other; else: show wordpress avatar ?
    is there no support for the plugin?

  6. r3bb
    Member
    Posted 4 years ago #

    alchymyth,

    First, thank you for your help! I know it would help if I provided a link to some comments that have both the facebook and wordpress avatars displaying, but in order to do that I'd have to have that display for every single comment on my blog. It looks very unprofessional, so I'm unwilling to do that.

    However, I do think you're onto something with the code above. Suppressing the wordpress avatar is one option, but in the case that people don't have a facebook avatar, they would be left witn no avatar at all. So yes, what would be perfect is a conditional code: if facebook avatar: show this and no other; else: show wordpress avatar.

    How can I do that?

  7. alchymyth
    The Sweeper & Moderator
    Posted 4 years ago #

    i will have a go at it tomorrow ;-)

  8. Samuel B
    moderator
    Posted 4 years ago #

    stop bumping - against the rules!

  9. alchymyth
    The Sweeper & Moderator
    Posted 4 years ago #

    unfortunately, your plugin seems to use the uses the same call of the avatar than the standard comments function.
    it could be that not adding the extra line will still show facebook avatars if available.
    if you like, you could post the html code of a page with both comments activated here in a pastebin.

  10. r3bb
    Member
    Posted 4 years ago #

    Thanks alchymyth, here's the link to the pastebin code:

    http://wordpress.pastebin.com/m1362076a

    Please note that the get_avatar code calls and displays the facebook picture.

    <?php echo get_avatar( $comment, 32 ); ?>

  11. alchymyth
    The Sweeper & Moderator
    Posted 4 years ago #

    thank you for posting the code. i can only find one ocurrance of get_avatar, so i don't see why there should be two avatar images on the same comment.
    without a live link to a comment where this ocurs, any help has to stop here.
    maybe more support is available from the plugin author?

Topic Closed

This topic has been closed to new replies.

About this Topic