Display Avatars For Logged In Users to Encourage Commenting

Paste this snippet anywhere in your theme’s template files to display the avatar of a logged-in user. I think it works well to put just above the comment form in your single.php file so that the user sees his photo above the comment form, encouraging him to have something to say. Check out the screenshot below of this snippet in action.

Here’s the code:

1
2
3
4
5
6
7
<?php
    global $current_user;
    
        get_currentuserinfo();
        
        echo get_avatar( $current_user->ID, 128 );
 ?>

Source: aext.net

Tags

Comments (4)

  1. thanks, great ideea sarah.

    I would like to know how can you make a field where people that have registered accounts can upload their avatar by a link (ex imageshack, etc.)
    i don’t want to use gravatars because the group of people that enter my blog don’t have accounts and some of them don’t even know what gravatar is.

    Thank you.

Participate