=== WP User Avatar ===
Contributors: flippercode
Tags: author image, author photo, author avatar, avatar, bbPress, profile avatar, profile image, user avatar, user image, user photo, widget
Requires at least: 3.6
Tested up to: 3.9
Stable tag: 1.9.13
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Use any image from your WordPress Media Library as a custom user avatar. Add your own Default Avatar.
== Description ==
WordPress currently only allows you to use custom avatars that are uploaded through [Gravatar](http://gravatar.com/). **WP User Avatar** enables you to use any photo uploaded into your Media Library as an avatar. This means you use the same uploader and library as your posts. No extra folders or image editing functions are necessary.
**Maintained and Supported by Flipper Code**
Flipper Code has been providing WordPress Services since 2008. Flipper Code expertise in [custom plugins development](http://codecanyon.net/user/flippercode/portfolio) and [wordpress websites development](http://www.flippercode.com/our-portfolio/).
**WP User Avatar** also lets you:
* Upload your own Default Avatar in your WP User Avatar settings.
* Show the user's [Gravatar](http://gravatar.com/) avatar or Default Avatar if the user doesn't have a WP User Avatar image.
* Disable [Gravatar](http://gravatar.com/) avatars and use only local avatars.
* Use the [avatar_upload]
shortcode to add a standalone uploader to a front page or widget. This uploader is only visible to logged-in users.
* Use the [avatar]
shortcode in your posts. These shortcodes will work with any theme, whether it has avatar support or not.
* Allow Contributors and Subscribers to upload their own avatars.
* Limit upload file size and image dimensions for Contributors and Subscribers.
Visit [WP User Avatar](http://wpuseravatar.com/) for more information and documentation.
== Installation ==
Visit [WP User Avatar](http://wpuseravatar.com/) for more information and documentation.
1. Download, install, and activate the WP User Avatar plugin.
2. On your profile edit page, click "Edit Image".
3. Choose an image, then click "Select Image".
4. Click "Update Profile".
5. Upload your own Default Avatar in your WP User Avatar settings (optional). You can also allow Contributors & Subscribers to upload avatars and disable Gravatar.
6. Choose a theme that has avatar support. In your theme, manually replace get_avatar
with get_wp_user_avatar
or leave get_avatar
as-is. [Read about the differences here](http://wordpress.org/extend/plugins/wp-user-avatar/faq/).
7. You can also use the [avatar_upload]
and [avatar]
shortcodes in your posts. These shortcodes will work with any theme, whether it has avatar support or not.
**Example Usage**
= Posts =
Within [The Loop](http://codex.wordpress.org/The_Loop), you may be using:
``
Replace this function with:
``
You can also use the values "original", "large", "medium", or "thumbnail" for your avatar size:
``
You can also add an alignment of "left", "right", or "center":
``
= Author Page =
On an author page outside of [The Loop](http://codex.wordpress.org/The_Loop), you may be using:
`ID, 96);
?>`
Replace this function with:
`ID, 96);
?>`
If you leave the options blank, WP User Avatar will detect whether you're inside [The Loop](http://codex.wordpress.org/The_Loop) or on an author page and return the correct avatar in the default 96x96 size:
``
The function get_wp_user_avatar
can also fall back to get_avatar
if there is no WP User Avatar image. For this to work, "Show Avatars" must be checked in your WP User Avatar settings. When this setting is enabled, you will see the user's [Gravatar](http://gravatar.com/) avatar or Default Avatar.
= Comments =
For comments, you might have in your template:
``
Replace this function with:
``
For comments, you must specify the $comment variable.
**Other Available Functions**
= [avatar_upload] shortcode =
You can use the [avatar_upload]
shortcode to add a standalone uploader to 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](http://wordpress.org/plugins/wp-user-avatar/other_notes/).
You can specify a user with the shortcode, but you must have edit_user
capability for that particular user.
`[avatar_upload user="admin"]`
= [avatar] shortcode =
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="medium" align="left" link="file" /]`
You can also add a caption to the shortcode:
`[avatar user="admin" size="medium" align="left" link="file"]Photo Credit: Your Name[/avatar]`
**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]
= get_wp_user_avatar_src =
Works just like get_wp_user_avatar
but returns just the image src. This is useful if you would like to link a thumbnail-sized avatar to a larger version of the image:
`
`
= has_wp_user_avatar =
Returns true if the user has a WP User Avatar image. You must specify the user ID:
`';
}
?>`
== Frequently Asked Questions ==
Visit [WP User Avatar](http://wpuseravatar.com/) 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
](http://codex.wordpress.org/Function_Reference/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](http://gravatar.com/) 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](http://gravatar.com/) 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](http://codex.wordpress.org/Function_Reference/get_avatar).
= 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](http://gravatar.com/) 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](http://gravatar.com/) 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](http://wordpress.org/plugins/wp-user-avatar/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:
`
`
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:
`
[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:
``
Outputs:
`[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:
`
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](http://wordpress.org/extend/plugins/wp-user-avatar/installation/)
= 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');`
== Advanced Settings ==
Visit [WP User Avatar](http://wpuseravatar.com/) for more information and documentation.
= Add WP User Avatar to your own profile edit page =
You can use the [avatar_upload] shortcode to add a standalone uploader to any page. It's best to use this uploader by itself and without other profile fields.
If you're building your own profile edit page with other fields, WP User Avatar is automatically added to the [show_user_profile](http://codex.wordpress.org/Plugin_API/Action_Reference/show_user_profile) and [edit_user_profile](http://codex.wordpress.org/Plugin_API/Action_Reference/show_user_profile) hooks. If you'd rather have WP User Avatar in its own section, you could add another hook:
`do_action('edit_user_avatar', $current_user);`
Then, to add WP User Avatar to that hook and remove it from the other hooks outside of the administration panel, you would add this code to the functions.php
file of your theme:
`function my_avatar_filter() {
// Remove from show_user_profile hook
remove_action('show_user_profile', array('wp_user_avatar', 'wpua_action_show_user_profile'));
remove_action('show_user_profile', array('wp_user_avatar', 'wpua_media_upload_scripts'));
// Remove from edit_user_profile hook
remove_action('edit_user_profile', array('wp_user_avatar', 'wpua_action_show_user_profile'));
remove_action('edit_user_profile', array('wp_user_avatar', 'wpua_media_upload_scripts'));
// Add to edit_user_avatar hook
add_action('edit_user_avatar', array('wp_user_avatar', 'wpua_action_show_user_profile'));
add_action('edit_user_avatar', array('wp_user_avatar', 'wpua_media_upload_scripts'));
}
// Loads only outside of administration panel
if(!is_admin()) {
add_action('init','my_avatar_filter');
}`
= HTML Wrapper =
You can change the HTML wrapper of the WP User Avatar section by using the functions wpua_before_avatar
and wpua_after_avatar
. By default, the avatar code is structured like this:
`
Original Size
Thumbnail
functions.php
file in your theme:
`remove_action('wpua_before_avatar', 'wpua_do_before_avatar');
remove_action('wpua_after_avatar', 'wpua_do_after_avatar');`
To add your own wrapper, you could create something like this:
`function my_before_avatar() {
echo '
Original Size
Thumbnail