Display current logged in user's avatar outside of the loop?

I use the famous User Photo plugin for my Wordpress site. I want to display the current logged in user's avatar outside the loop. How is this possible?

The current code I use to display the author avatar inside the loop is:

<?php userphoto_the_author_thumbnail('', '', array(width => '40', height => '40')); ?>

Google did not give me much to go on. One person referred to this code:

global $authordata;
$authordata=get_userdata(get_query_var( 'author' ));

But it did not work. What is the solution?


Use userphoto_thumbnail() and pass the user ID explicitly.


userphoto_thumbnail($user, $before = '', $after = '', $attributes = array(), $default_src = '')

Try the below code.

It will select the current logged-in user's email and then display the avatar.

    $current_user_email = $current_user->user_email;
<?php echo get_avatar( '$current_user_email', 40 ); ?>

Please try one of thes two.

userphoto($user, $before = '', $after = '', $attributes = array(), $default_src = '')


userphoto_thumbnail($user, $before = '', $after = '', $attributes = array(), $default_src = '')

Both function work same as userphoto_the_author_thumbnail


Need Your Help

Returning a promise to the caller

javascript jquery promise

I have a function HelloWorld where no promises is returned to the caller. I wonder if it is possible to have this function to adjust to return a promise.

Cannot open word file for editing from access using vba

ms-access access-vba ms-access-2010 word-2010

The following code runs as far as the marked line. Word then shows a file locked for editing/ open read only prompt. I need to be able to edit the document (that is the whole point of the code).

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.