Forums

Avatar Display for Logged In Users (6 posts)

  1. SCRAWL Editor
    Member
    Posted 3 years ago #

    I currently have this code on my site to display the avatar for logged in users:

    <?php
    echo get_avatar( get_the_author_id(), '45', 'http://scrawlfx.com/wp-content/gravatars/blank_gravatar.png');
    ?>

    Until a buddy of mine signed up on my blog, I haven't realized that it just displays the avatar of the admin across everyone's user names. How would I make it so that it displays only the avatar of the person logged in?

    Thanks!

  2. ClaytonJames
    Member
    Posted 3 years ago #

    Might be something useful here:

    http://codex.wordpress.org/Using_Gravatars

    I know it's 2.5 oriented, but maybe it will point you in the right direction, or this thread might solve it entirely.

    http://wordpress.org/support/topic/194683?replies=6

  3. SCRAWL Editor
    Member
    Posted 3 years ago #

    @ClaytonJames

    Darn. Neither helped. Thanks for the effort, though. =\

  4. ClaytonJames
    Member
    Posted 3 years ago #

    Ok. I'm going to go out on a limb here and show my brazen stupidity, because frankly I know nothing about gravatar support. I basically understand the functions listed, but I do not understand the significance of the "45" or "46" values that are used in these examples. My gut tells me that it might refer to avatar display properties/size, but that's a guess as well.

    This is some code that was present in a theme I have been tinkering with for a while, I have no idea if it is of any use or not...

    <?php global $userdata; get_currentuserinfo(); echo get_avatar( $userdata->ID, 46 ); ?>

    ...if not, please feel free to openly laugh at, and ridicule me and then chuck it all in the trash!

    :-)

  5. SCRAWL Editor
    Member
    Posted 3 years ago #

    It worked! =D
    Thank you so much!

  6. ClaytonJames
    Member
    Posted 3 years ago #

    Well, tie me to an ant hill and spread jam in my ears. I'm as surprised as you are! And you're welcome!

    If you get a chance and don't mind, mark this one resolved. It might be useful to someone else and easier for them to spot later on down the road.

    Best wishes

Topic Closed

This topic has been closed to new replies.

About this Topic