Description
Adds 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… Well, from WordPress 2.5 onwards, you can manage local and global avatars with this plugin. Plus you can use your Twitter avatar too!
From v9.0 Avatars requires PHP version 5.1.3 or greater.
The plug-in now delivers the much requested feature of allowing users to upload their own local avatar. And, the latest new feature allows your users to use their Twitter avatar. The order of precedence is; Local, Twitter, then Global. In other words; if you define a Local avatar for a user, that will be used, if there is no Local avatar defined and a Twitter ID is given for a user, the plugin will try to use that avatar. Lastly, where no Local avatar is defined and no Twitter ID is given (or Twitter doesn’t return a match), a unique Global avatar (Gravatar) will be generated.
The local avatar feature list:
- Have global or local avatars for your users.
- Use Twitter avatars for your users.
- Allow avatars to be included in posts. This is achieved securely; e-mail addresses are not exposed.
- Detailed control over the default avatar to use for those users who do not have a global or local avatar. Allows a choice of a custom image, ‘mystery’ blank image, blank, Wavatar, Monster ID, or Identicon.
- Wraps avatars in code to support SnapShots (www.snap.com), should your site use these.
- Permits users to upload their own local avatars.
You may also be interested in the sister Comments with Avatars plugin.
Plus there is now a new sidebar widget extension to the plug-in that provides a feature allowing users to manage their avatar from the sidebar without having to use WordPress’ profile administration page. It provides the same capability as the profile page. This new feature provides yet more support for users who may not, for example, be savvy enough to use the WordPress administration interface. Get the extension here.
Donations are welcome and help keep development going.
Thanks
A lot of hard work has gone in to this plug-in, much of it at the request of people who use it, and I hope it is useful to you too! Please consider these things…
- Please recognise your use of the plug-in on your blog. Maybe post an article (with a link back to http://www.sterling-adventures.co.uk/blog/) to say how you’ve integrated the plug-in into your site? Or simply make sure the Author Credit option is enabled on the options page.
- Remember that a lot of the features of the plug-in are a direct result of people asking for them. So, please get in contact and let me know what you think.
- If you do find value in using the plug-in, please consider a donation at http://www.sterling-adventures.co.uk/blog/2008/03/01/avatars-plugin/ Size isn’t important, it’s the thought that counts!
Enjoy!
Internationalisation
Avatars provides support for language translations. Ensure WPLANG is set in your wp-config
file.
To help with the available translations create a .po translation and compile a .mo file. If you would like this to be included in the general distribution please send these files back via the feedback link. I can’t accept any credit for these languages files, nor can I guarantee they are correct.
Available translations, from the English default, are:
- Persian (WPLANG = fa_IR). Thanks to Mustafa Sufi.
- Russian (WPLANG = ru_RU). Thanks to Levati.
- French (WPLANG = fr_FR). Thanks to Adrien Schvalberg.
- Spanish (WPLANG = es_ES). Thanks to Naceira – http://www.naceira.com/
- Ukrainian (WPLANG = uk_UK). Thanks to Vadim Nekhai, website: http://onix.name/portfolio/
- Portuguese Brazil (WPLANG = pt_BR). Thanks to Steff.
- Japanese (WPLANG = pt_ja). Thanks to Kazuhiko Maeda.
- Czech (WPLANG = cs_CZ). Thanks to Dominik Chrástecký.
Screenshots
An example of the main avatars administration page. Manage users global and local avatars etc. The avatars options configuration section of the main avatars administration page. The WordPress profile page shows the new floating section showing the current avatar. Click manage to change. Avatar Management popup. Allowing upload of local avatars, with crop option, and setting of a Twitter ID. Sample avatars: local, global, retro, gravatar, blank, wavatar, identicon, monsters, twitter - the lot! Example of the optional simple sidebar widget allowing users to manage their own avatar. Available from the plugin's homepage.
Installation
- Just put the plug-in into your plug-in directory 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
, whereavatars
is 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. - Plus, you can also take advantage of the Gravatar.com feature to use Wavatar, Monster ID, Identicon, etc.
- Use:
<?php $avtr = get_avatar(id [, size [, default-image-url]]); echo $avtr; ?>
- More example code to include in your template files is documented on the
Users
»Avatars
page.
FAQ
- Installation Instructions
-
- Just put the plug-in into your plug-in directory 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
, whereavatars
is 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. - Plus, you can also take advantage of the Gravatar.com feature to use Wavatar, Monster ID, Identicon, etc.
- Use:
<?php $avtr = get_avatar(id [, size [, default-image-url]]); echo $avtr; ?>
- More example code to include in your template files is documented on the
Users
»Avatars
page.
- How to install Avatars in a WordPress Multi Site environment
-
Getting this plugin to work under a WordPress (WP) Multi Site (MS) configuration can be tricky, but as the instructions for WP MS installations say, you are expected to know what you are doing and have basic WordPress development, PHP, HTML, CSS, and UNIX/Linux administration experience. See https://codex.wordpress.org/Create_A_Network. However, here are some steps that have worked for others configuring this plugin for WP MS.
- In the Network Admin area, network activate the plugin.
- Now under Users » Avatars look for the User Uploads option, check the box and save.
- When to use the Legacy Method for User Uploads
-
Often the legacy method for User Uploads is required when using sub-domains. Therefore, this is also regularly required for WordPress Multi Site setups.
- Setting the User Upload directory
-
The directory uploaded Avatars are stored in is set by the field next to the enable user uploads option. There is an example
/avatars
given in the instructions beneath the field.
This directory must be relative to your web-root. For example, if all of your HTML files and your WP installation are in a directorypublic_html
provided by your web host, this is the web-root. So the/avatars
directory goes here, i.e.~/public_html/avatars
.
Make sure the privileges are set correctly. - Where are the Avatar options
-
The options for the Avatar plugin are available on the
User
»Avatars
page, at the bottom. - Show the Avatar of the logged in User
-
If you are trying to show, say somewhere in a sidebar, the Avatar of the user who is logged-in try code something like this:
<?php global $current_user; $known = !empty($current_user->nickname); ?> <div style="float: right; margin: 4px;"> <?php if($known) echo get_avatar($current_user->id, 30); ?> </div>
- Optional Widget
-
If you are considering purchasing the optional user profile widget, please make sure that this free Avatars plugin is configured properly and functioning correctly first. The widget cannot work until the plugin is setup correctly. The widget is not required in any way to make full use of all the plugin’s features.
- Styling
-
Got problems with you layout? Take a look at adjusting the
avatars.css
file. Perhaps removingclear: both;
if alignment is being disrupted. - New Ideas?
-
Got your own great idea for addition in to the Avatars plugin’s capabilities? Let me know about it and I’ll consider if it’s possible to include in the next release…
Reviews
Contributors & Developers
“Add Local Avatar” is open source software. The following people have contributed to this plugin.
ContributorsTranslate “Add Local Avatar” into your language.
Interested in development?
Browse the code, check out the SVN repository, or subscribe to the development log by RSS.
Changelog
Changes and feature additions for the Local Avatar plugin:
- 0.1 – Initial release.
- 1.0 – Added pagination of users list.
- 2.0 – Added pagination of the commenters list too.
- 2.1 – Added example formatting information.
- 3.0 – Added ability to place avatars in written post content (plus other tweaks).
- 3.1 – Minor tweaks to usage text and options.
- 3.2 – Added check for administration pages to stop user URL wrapping breaking comment editing.
- 3.3 – Spelling fixes!
- 4.0 – Wavatar, Monster ID and Identicon can be used.
- 4.1 – Author credit.
- 4.2 – Fix for credit option un-setting.
- 5.0 – Avatar options should only be managed by Administrators.
- 5.1 – Minor fix to repetition of show avatars WordPress setting.
- 5.2 – Cope with WP 2.6 avatar default.
- 6.0 – Added feature to allow users to upload their own avatar.
- 6.1 – Explanation of directory structure and ‘chmod’ fix, thanks to Tobias Schwarz.
- 6.2 – Improved unique file name creation, optional avatar upload resizing/cropping, and PHP 4 fix. Thanks to Gioele Agostinelli.
- 6.3 – Oops, a bug (mistake) with the scaling size fixed.
- 6.4 – Error in file naming fixed, with some help from “noyz319”.
- 6.5 – Upload file type check (thanks to SumoSulsi) and internationalisation preparation.
- 6.6 – Fix to scaling when upgrading from old version of plugin without scaling option.
- 6.7 – Fix for lowercase extensions.
- 6.8 – Option for nickname / first name & surname.
- 7.0 – Support for user profile widget plug-in.
- 7.1 – Update for Marc Adrian to provide support for option for showing text in the optional widget.
- 7.2 – Class added to help with styling widget.
- 7.3 – Fix for user avatar upload that doesn’t need re-sizing and a Russian translation.
- 7.4 – Root directory no longer DOCUMENT_ROOT.
- 7.5 – Use DOCUMENT_ROOT option for legacy users.
- 7.6 – Check for required core WP upload functions, only required for themes that expose the user profile pages.
- 8.0 – Added option to try to use a Twitter avatar.
- 8.1 – Simplified Twitter image URL logic.
- 8.2 – Control anchor wrapping of Avatars.
- 8.3 – Allow Twitter ID for optional widget.
- 9.0 – WPMU/Network re-work. Thanks to Michael D. Tran for his efforts!
- 9.1 – Update for Admin Bar in WordPress v3.1
- 9.2 – Fix for local avatar upload to cope with the ever changing WP!
- 10.0 – New option to upsize local avatar images that are smaller than the set size. Thanks to Nicholas Craig.
- 10.1 – Update for networked WP. Thanks to Michael D Tran.
- 10.2 – alt tag for avatar img.
- 10.3 – Compress the paging header for Avatar tables, plus tidy up of table output code.
- 10.4 – Add ‘retro’ dynamic automatic Avatar type.
- 10.5 – Small change to hack for new (WP 3.3) Admin Bar style.
- 10.6 – Avatar settings link.
- 10.7 – Accidental removal of user editing avatar uploading section, now back where it should be!
- 11.0 – Crop user upload image for use as avatar. Thanks to Barry Israel for the inspiration.
- 11.1 – Sanitize upload filenames.
- 11.2 – Fix for WP_PLUGIN_DIR (and updates for deprecated WP function calls).
- 11.3 – Fixes and removal of deprecated functions thanks to Ponç J. Thanks!
- 12.0 – Use new Twitter OAuth API v1.1.
- 12.1 – Thanks to Per for pointing out that the Profile display needed moving down a bit…