Mar 01 |
WordPress (from version 2.5) includes native support for global avatars. Great!
But, what about adding local (private) avatars for your users? Maybe your users don’t want a global avatar, aren’t IT savvy enough to set a gravatar up, simply want a private avatar for your blog, or any other reason too…
This plugin does exactly that. Adds the ability to have local avatars in WordPress. I’m quite pleased with it. ![]()
So, I think it is worth shouting about, and possibly sharing…
The plug-in is available as a download here.
All I ask is that you credit the widget (i.e. include a link to this page or maybe add a link to your WordPress Blogroll).
Because of some demand, please feel free to make a donation here if you find the code valuable!
Thanks!
Instructions:
- Just put the plug-in into your plug-in directory (if this doesn’t make sense it probably isn’t something you should be trying
) and activate it. - Use the form,
Users»Avatars, to define any local avatars for your users. Specify the URI for an avatar image, something likehttp://your.domain/avatars/image.jpg, whereavatarsis a directory containing your local images. - Also you may set a default size (in pixels) for avatars and define a default image (e.g.
http://your.domain/avatars/default.jpg) to use when no local or global avatar is available. - The code to include in your template files is documented on the
Users»Avatarspage too. To start with try:- Put
get_avatars($comment);inside the comments loop of your comments.php template file to show the comment author’s avatar. - Put
get_avatar($post->post_author);in your single.php template file to show the post author’s avatar. You’ll need to declareglobal $post;in the file too.
- Put
- A feature that I have discovered is to have the default generate a unqiue Wavatar (other options exist, check the link)! Nice, and no extra coding.
But please note I will have to ask for a donation before I’ll look at “how to” questions…
Version History:
- 5.2 - Cope with WP 2.6 avatar default.
- 5.1 - Minor fix to repetition of show avatars WordPress setting.
- 5.0 - Avatar options should only be managed by Administrators.
- 4.2 - Fix for credit option un-setting.
- 4.1 - Author credit.
- 4.0 - Wavatar, Monster ID and Identicon can be used.
- 3.3 - Spelling fixes!
- 3.2 - Added check for administration pages to stop user URL wrapping breaking comment editing.
- 3.1 - Minor tweaks to usage text and options.
- 3.0 - Added ability to place avatars in written post content (plus other tweaks).
- 2.1 - Added example formatting information.
- 2.0 - Added pagination of the commenters list too.
- 1.0 - Added pagination of users list.
- 0.1 - Initial version.


22 Responses to “Avatars Plugin”
Saturday, April 5th, 2008 at 7:13 am
What parameters do I enter in this code, and how do I enter them:
I entered 30 for 30px, but I only get the default avatar.
My local avatar location is /wp-content/gravatars/local/. I entered this in Design -> Theme Editor -> User -> Avatars.
Saturday, April 5th, 2008 at 7:29 pm
The configuration options are under the Users menu on the Avatars item… Just like it says under the instructions above.
You need to enter the path and filename of the local avatar - check the example above (3rd bullet of the instructions). Good luck.
Monday, April 7th, 2008 at 6:00 am
On the Users » Avatars page it lists the first 50 users on the blog, but there doesn’t seem to be any pagination, how do I get to the other users?
Monday, April 7th, 2008 at 9:53 am
That was the whole trick! Thank you so much. Your plugin is the one I’ve been looking for for a while now.
Monday, April 7th, 2008 at 10:05 am
Patung,
there is no limit on the number returned and there is no pagination (just a simple list). So, are you sure you don’t have just the 50 users?correction, there is a limit set by WordPress! I will fix this and get an updated version out ASAP.Update: Now fixed for user paging! Download from this page (link above) or wait till the WordPress.org hosting refreshes.
Monday, April 7th, 2008 at 4:31 pm
Sory … but i dont understand - HOW users can upload their own avatars

Monday, April 7th, 2008 at 4:39 pm
It makes tons of errors…
Monday, April 7th, 2008 at 8:20 pm
Dmitry, users cannot upload their own avatars. The admin must set them up; put the image files in a directory somewhere (e.g. /wp-content/avatars/) and then set them up under the Users >> Avatars menu…
Monday, April 7th, 2008 at 8:59 pm
I’m thrilled there’s something out there like this! I’ve always thought avatars/userpics/icons were a basic part of blogs… I was surprised to not see it part of the default WP package!
I’m wondering if there’s a way to allow an “Upload” system, even if only the Admin can set them up. E.g. some sort of “Upload” button that would take care of uploading the image and putting it in the proper directory. Would a future release maybe allow for the Admin to set users with the privileges to pick their own avatar?
Monday, April 7th, 2008 at 9:00 pm
Sorry Eh, I don’t think you are using the plug-in correctly. Are you using WordPress version 2.5? Just put the URI of a default image in as the default. If you put the same thing into your browser’s address bar it should show the image, if it doesn’t it’s wrong! So, there’s no way the plug-in can use it…
Hmm, and 1 error (of your making, not the plug-in at all) isn’t really “tons” is it!
Monday, April 7th, 2008 at 9:02 pm
Meredith, I will look into it in time…
Monday, April 7th, 2008 at 9:13 pm
This is a goofy question, but what are the template files where I might put
? If I want the avatar to appear in the upper left of every post, or maybe in the footer of the post, next to the author name, what file would be appropriate for that?Monday, April 7th, 2008 at 9:21 pm
I put
get_avatars($comment);inside the comments loop of my comments.php template file to show the comment authors avatar, andget_avatar($post->post_author);in my single.php template file to show the post author’s avatar.Monday, April 7th, 2008 at 9:37 pm
Are the comments.php and single.php pages you mentioned part of the default WP package? Where would I find them? (I’ve looked, but don’t see anything by those names, so I’m wondering if the names are different, or if I’m just looking in the wrong places.)
Monday, April 7th, 2008 at 10:39 pm
They are templates files - look in wp-content/themes/ - you should (at least) have a default template…
Tuesday, April 8th, 2008 at 2:37 pm
How would you make the avatar image align to the right of the comment text? Thanks.
Wednesday, April 9th, 2008 at 12:38 am
Nollie, please check out the various references to HTML available on the web - just Google for what you want…
Something like
style="float: right;"Wednesday, April 9th, 2008 at 1:45 am
Thanks for the tip. I inserted the formatting code into stylesheet.css, and restored avatars.php. It’s working well now.
Wednesday, April 9th, 2008 at 6:09 am
Pete, I have avatars working on my comments, but I can’t get them to work on my single.php page. I keep getting this error:
I don’t think I have: get_avatar($post->post_author); in the right place.
Wednesday, April 9th, 2008 at 11:40 am
Craig, you may need to have this declaration,
<?php global $post; ?>Other than that I can’t really help - it could be any number of problems with your template file that I nor the plug-in have any control over…
Update: now (May) fixed in any case
Thursday, June 19th, 2008 at 9:49 am
[...] I used Avatars Plugin from http://www.sterling-adventures.co.uk [...]
Thursday, July 17th, 2008 at 11:04 am
Avatars…
The new version of WordPress adds native support for global avatars. Great! But, what about adding local (private) avatars for your users? Maybe your users don’t want a global avatar, aren’t IT savvy enough to set a gravatar up, simply want a private…