WordPress.org

Ready to get started?Download WordPress

Forums

get_avatar not showing the loggedin users right avatar after comments (1 post)

  1. vgpap
    Member
    Posted 2 years ago #

    I use the following code to display logged in users avatar and some other staff.
    if ( is_user_logged_in() ) {
    get_currentuserinfo();
    global $current_user;
    echo $user_id = $current_user->ID;

    echo '<div class="avatar">';
    echo get_avatar( $user_id, 32 );
    echo "</div>";
    }

    Eveything works fine.

    When before this thing i display comments, the avartar of current loggen inuser is wrong, its one of the comment author avatar.

    I echo the $user_id = $current_user->ID and is the right one but echo get_avatar( $user_id, 32 ) returns other.

    Any idea?
    Thanks.

Topic Closed

This topic has been closed to new replies.

About this Topic