WordPress.org

Ready to get started?Download WordPress

Plugin Directory

WP User Avatar

Use any image from your WordPress Media Library as a custom user avatar. Add your own Default Avatar.

Visit WP User Avatar for more information and documentation.

How do I use WP User Avatar?

First, choose a theme that has avatar support. In your theme, you have a choice of manually replacing get_avatar with get_wp_user_avatar, or leaving get_avatar as-is. Here are the differences:

get_wp_user_avatar

  1. Allows you to use the values "original", "large", "medium", or "thumbnail" for your avatar size.
  2. Doesn't add a fixed width and height to the image if you use the aforementioned values. This will give you more flexibility to resize the image with CSS.
  3. Allows you to use custom image sizes registered with add_image_size (fixed width and height are added to the image).
  4. Optionally adds CSS classes "alignleft", "alignright", or "aligncenter" to position your avatar.
  5. Shows nothing if the user has no WP User Avatar image.
  6. Shows the user's Gravatar avatar or Default Avatar only if "Show Avatars" is enabled in your WP User Avatar settings.

get_avatar

  1. Requires you to enable "Show Avatars" in your WP User Avatar settings to show any avatars.
  2. Accepts only numeric values for your avatar size.
  3. Always adds a fixed width and height to your image. This may cause problems if you use responsive CSS in your theme.
  4. Shows the user's Gravatar avatar or Default Avatar if the user doesn't have a WP User Avatar image. (Choosing "Blank" as your Default Avatar still generates a transparent image file.)
  5. Requires no changes to your theme files if you are currently using get_avatar.

Read more about get_avatar in the WordPress Function Reference.

Can I create a custom Default Avatar?

In your WP User Avatar settings, you can upload your own Default Avatar.

Can I disable all Gravatar avatars?

In your WP User Avatar settings, you can select "Disable Gravatar — Use only local avatars" to disable all Gravatar avatars on your site and replace them with your Default Avatar. This will affect your registered users and non-registered comment authors.

Can Contributors or Subscribers choose their own WP User Avatar image?

Yes, if you enable "Allow Contributors & Subscribers to upload avatars" in the WP User Avatar settings. These users will see a slightly different interface because they are allowed only one image upload.

Will WP User Avatar work with comment author avatars?

Yes, for registered users. Non-registered comment authors will show their Gravatar avatars or Default Avatar.

Will WP User Avatar work with bbPress?

Yes!

Will WP User Avatar work with BuddyPress?

No, BuddyPress has its own custom avatar functions and WP User Avatar will override only some of them. It's best to use BuddyPress without WP User Avatar.

Will WP User Avatar work with WordPress Multisite?

Yes, however, each site has its own avatar settings. If you set a WP User Avatar image on one site, you have to set it again for different sites in your network.

How can I see which users have an avatar?

For Administrators, WP User Avatar adds a column with avatar thumbnails to your Users list table. If "Show Avatars" is enabled in your WP User Avatar settings, you will see avatars to the left of each username instead of in a new column.

Can I use the WP User Avatar uploader in a front page or widget?

Yes, you can use the [avatar_upload] shortcode to put a standalone uploader in a front page or widget. This uploader is only visible to logged-in users. If you want to integrate the uploader into a profile edit page, see Other Notes.

You can specify a user with the shortcode, but you must have 'edit_user' capability to change the user's avatar.

[avatar_upload user="admin"]

Can I insert WP User Avatar directly into a post?

You can use the [avatar] shortcode in your posts. It will detect the author of the post or you can specify an author by username. You can specify a size, alignment, and link, but they are optional. For links, you can link to the original image file, attachment page, or a custom URL.

[avatar user="admin" size="96" align="left" link="file" /]

Outputs:

<a href="{fileURL}" class="wp-user-avatar-link wp-user-avatar-file">
  <img src="{imageURL}" width="96" height="96" class="wp-user-avatar wp-user-avatar-96 alignleft" />
</a>

If you have a caption, the output will be similar to how WordPress adds captions to other images.

[avatar user="admin" size="96" align="left" link="file"]Photo Credit: Your Name[/avatar]

Outputs:

<div style="width: 106px" class="wp-caption alignleft">
  <a href="{fileURL}" class="wp-user-avatar-link wp-user-avatar-file">
    <img src="{imageURL}" width="96" height="96" class="wp-user-avatar wp-user-avatar-96" />
  </a>
  <p class="wp-caption-text">Photo Credit: Your Name</p>
</div>

Note: If you are using one shortcode without a caption and another shortcode with a caption on the same page, you must close the caption-less shortcode with a forward slash before the closing bracket: [avatar /] instead of [avatar]

What CSS can I use with WP User Avatar?

WP User Avatar will add the CSS classes "wp-user-avatar" and "wp-user-avatar-{size}" to your image. If you add an alignment, the corresponding alignment class will be added:

<?php echo get_wp_user_avatar($user_id, 96, 'left'); ?>

Outputs:

<img src="{imageURL}" width="96" height="96" class="wp-user-avatar wp-user-avatar-96 alignleft" />

Note: "alignleft", "alignright", and aligncenter" are common WordPress CSS classes, but not every theme supports them. Contact the theme author to add those CSS classes.

If you use the values "original", "large", "medium", or "thumbnail", no width or height will be added to the image. This will give you more flexibility to resize the image with CSS:

<?php echo get_wp_user_avatar($user_id, 'medium'); ?>

Outputs:

<img src="{imageURL}" class="wp-user-avatar wp-user-avatar-medium" />

Note: WordPress adds more CSS classes to the avatar not listed here.

If you use the [avatar] shortcode, WP User Avatar will add the CSS class "wp-user-avatar-link" to the link. It will also add CSS classes based on link type.

  • Image File: wp-user-avatar-file
  • Attachment: wp-user-avatar-attachment
  • Custom URL: wp-user-avatar-custom
[avatar user="admin" size="96" align="left" link="attachment" /]

Outputs:

<a href="{attachmentURL}" class="wp-user-avatar-link wp-user-avatar-attachment">
  <img src="{imageURL}" width="96" height="96" class="wp-user-avatar wp-user-avatar-96 alignleft" />
</a>

What other functions are available for WP User Avatar?

  • get_wp_user_avatar_src: retrieves just the image URL
  • has_wp_user_avatar: checks if the user has a WP User Avatar image
  • See example usage here

There's a call for donations in the WP User Avatar settings. How can I remove it?

I've spent countless hours developing this plugin for free. If you're able to give a donation I'd appreciate it, but it's by no means a requirement. You can remove the message by adding this to the functions.php file of your theme:

remove_action('wpua_donation_message', 'wpua_do_donation_message');

Requires: 3.6 or higher
Compatible up to: 3.9.1
Last Updated: 2014-6-26
Downloads: 491,942

Ratings

4 stars
4.7 out of 5 stars

Support

8 of 28 support threads in the last two months have been resolved.

Got something to say? Need help?

Compatibility

+
=
Works!

8 people say it works.
1 person says it's broken.

100,2,2 100,1,1 100,8,8 100,1,1 100,2,2 50,2,1 50,2,1 100,1,1 100,3,3 50,2,1 100,1,1 100,1,1 67,3,2
100,1,1 100,2,2 100,1,1
100,1,1 100,1,1 100,2,2
100,1,1 100,1,1 100,1,1 100,2,2
100,2,2 100,1,1 100,1,1 100,1,1
100,3,3 100,1,1 100,2,2
100,3,3 100,3,3 100,2,2 67,3,2 100,2,2 100,1,1 100,2,2
100,2,2 100,1,1
0,1,0 100,1,1 100,1,1 100,1,1 100,1,1 0,1,0 100,1,1
89,9,8