Support
Support » Fixing WordPress » get_avatar not showing the loggedin users right avatar after comments
(@vgpap)
11 years, 11 months 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.
(@vgpap)
11 years, 11 months 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.