Simple Local Avatars
Add an avatar upload field to user profiles. Generate requested sizes on demand, just like Gravatar.
Adds an avatar upload field to user profiles if the current user has media permissions. Generates requested sizes on demand just like Gravatar! Simple and lightweight.
Just edit a user profile, and scroll down to the new “Avatar” field. The plug-in will take care of cropping and sizing!
- Stores avatars in the “uploads” folder where all of your other media is kept.
- Has a simple, native interface.
- Fully supports Gravatar and default avatars if no local avatar is set for the user – but also allows you turn off Gravatar.
- Generates the requested avatar size on demand (and stores the new size for efficiency), so it looks great, just like Gravatar!
- Lets you decide whether lower privilege users (subscribers, contributors) can upload their own avatar.
- Enables rating of local avatars, just like Gravatar.
[2.7.5] – 2023-05-12
- Added: Ajax loading animation during process of uploading and deleting local avatars (props @lllopo, @BhargavBhandari90, @faisal-alvi via #204).
- Changed: Avatar removal button text (props @jayedul, @jeffpaul, @dkotter, @faisal-alvi via #208).
- Changed: WordPress “tested up to” version 6.2 (props @jayedul, @faisal-alvi via #210).
- Changed: Run E2E tests on the zip generated by “Build release zip” action (props @jayedul, @iamdharmesh, @faisal-alvi via #205).
- Security: Bump
webpack
from 5.75.0 to 5.76.1 (props @dependabot, @faisal-alvi via #207).
2.7.4 – 2023-02-23
- Fixed: Support passing
WP_User
toget_avatar()
(props @mattheu, @faisal-alvi via #193). - Fixed: Remove trailing commas in function calls (props @patrixer, @dkotter, @sekra24, @faisal-alvi via #196).
- Security: Bump
simple-git
from 3.15.1 to 3.16.0 (props @dependabot, @faisal-alvi via #191). - Security: Bump
http-cache-semantics
from 4.1.0 to 4.1.1 (props @dependabot, @faisal-alvi via #197).
2.7.3 – 2023-01-16
- Fixed: Issue causing fatal errors when avatars used on front end of site (props @Rottinator, @peterwilsoncc, @ravinderk, @faisal-alvi via #187).
- Fixed: Deprecation error in admin on PHP 8.0 and later (props @Rottinator, @peterwilsoncc, @ravinderk, @faisal-alvi via #187).
2.7.2 – 2023-01-13
- Added: Filter hook
simple_local_avatars_upload_limit
to restrict image upload size & image file checking enhanced (props @Shirkit, @jayedul, @faisal-alvi, @jeffpaul via #171). - Added: GitHub Actions summary on Cypress e2e test runs (props @faisal-alvi, @jeffpaul, @iamdharmesh via #174).
- Changed: Cypress integration migrated from 9.5.4 to 11.2.0 (props @iamdharmesh, @jayedul, @faisal-alvi via #172).
- Fixed: PHP8 support for
assign_new_user_avatar
(props @lllopo, @mattwatsoncodes, @faisal-alvi via #183). - Fixed: Fixed the user profile language not respected issue (props @dkotter, @lllopo, @faisal-alvi, @jeffpaul via #175).
- Removed: textdomain from the core strings and the function
update_avatar_ratings
as it’s not required anymore (props @dkotter, @lllopo, @faisal-alvi, @jeffpaul via #175). - Security: Bump
json5
from 1.0.1 to 1.0.2 (props @dependabot, @faisal-alvi via #182).
2.7.1 – 2022-12-08
- Added: Added missing files from the last release and changed the readme file to fix the bullet points and added fullstops.
2.7.0 – 2022-12-08
- Added: Added
Build release zip
GitHub Action (props @peterwilsoncc, @faisal-alvi via #168). - Changed: Set plugin defaults on
wp_initialize_site
instead of deprecated actionwpmu_new_blog
(props @kadamwhite, @faisal-alvi via #156). - Changed: Support Level from Active to Stable (props @jeffpaul, @dkotter via #159).
- Changed: Build tools: Allow PHPCS installer plugin to run without prompting user (props @peterwilsoncc, @jeffpaul via #164).
- Changed: WP tested up to version bump to 6.1 (props @peterwilsoncc, @faisal-alvi via #165).
- Fixed: Non admin users can not crop avatar (props @jayedul, @faisal-alvi, @zamanq, @dkotter, @jeffpaul via #155).
- Security: Bump
@wordpress/env
from 4.9.0 to 5.2.0 andgot
from 10.7.0 to 11.8.5 (props @dependabot, @faisal-alvi via #153). - Security: Bump
loader-utils
from 2.0.2 to 2.0.3 (props @dependabot, @faisal-alvi via #160). - Security: Bump
loader-utils
from 2.0.3 to 2.0.4 (props @dependabot, @peterwilsoncc via #162). - Security: Bump
simple-git
from 3.9.0 to 3.15.1 (props @dependabot via #176).
2.6.0 – 2022-09-13
Note that this release bumps the minimum required version of WordPress from 4.6 to 5.7 and PHP from 5.6 to 7.4.
- Added: If a default avatar image is used, ensure that outputs alt text. This will either be default text (Avatar photo) or the alt text from the uploaded default image (props @dkotter, @faisal-alvi via #147)
- Added: Two hooks,
simple_local_avatar_updated
andsimple_local_avatar_deleted
, (props @t-lock, @faisal-alvi, @dkotter via #149) - Changed: Bump minimum required version of WordPress from 4.6 to 5.7 (props @vikrampm1, @faisal-alvi, @cadic via #143).
- Changed: Bump minimum required version of PHP from 5.6 to 7.4 (props @vikrampm1, @faisal-alvi, @cadic via #143).
- Changed:The plugin is now available via Composer without any additional steps required (props @faisal-alvi, @kovshenin, @jeffpaul via #145)
- Security: Bump
terser
from 5.14.1 to 5.14.2 (props @dependabot, @faisal-alvi via #142)
2.5.0 – 2022-06-24
- Added: Skip cropping button (props @dkotter, @faisal-alvi, @cadic, @jeffpaul, @dinhtungdu via #130)!
- Added: Updated the button name from “Skip Crop” to “Default Crop” only on the edit profile page (props @faisal-alvi, @peterwilsoncc via #136).
- Added: If an image used for a local avatar has alt text assigned, ensure that alt text is used when rendering the image (props @dkotter, @pixelloop, @faisal-alvi via #127).
- Added: Support for bbPress by loading the JS at FE on the profile edit page (props @foliovision, @faisal-alvi, @iamdharmesh via #134).
- Added: Cypress E2E tests (props @faisal-alvi, @vikrampm1, @Sidsector9 via #115).
- Fixed: Broken avatar URLs for network-configured shared avatars with non-standard thumbnail sizes (props @vladolaru, @faisal-alvi via #125).
- Fixed:
HTTP_REFERER
is null and causing PHP warning (props @alireza-salehi, @faisal-alvi, @peterwilsoncc via #129).
2.4.0 – 2022-05-10
- Added: Ability to set a default avatar. (props @mehulkaklotar, @jeffpaul, @dinhtungdu, @faisal-alvi via #96).
- Fixed: Correct plugin name in changelog. (props @grappler, @jeffpaul via #117).
- Fixed: Avatar cache not being cleared. (props @thefrosty, @jeffpaul, @faisal-alvi, @peterwilsoncc via #118 & #120).
- Security: Dev dependency
@wordpress/scripts
upgraded to resolve deeper level dependency security issues. (props @jeffpaul, @faisal-alvi, @cadic via #119).
2.3.0 – 2022-04-25
- Added: Crop screen (props @jeffpaul, @helen, @ajmaurya99, @Antonio-Laguna, @faisal-alvi).
- Added: Avatar preview for Subscribers (props @ankitguptaindia, @dinhtungdu, @dkotter).
- Added: More robust multisite support and shared avatar setting (props @adamsilverstein, @helen, @jeffpaul, @dkotter, @faisal-alvi, @holle75).
- Added: Settings link to plugin action links (props @rahulsprajapati, @jeffpaul, @iamdharmesh).
- Added: Dashboard setting and WP-CLI command to migrate avatars from WP User Avatar (props @jeffpaul, @claytoncollie, @helen, @faisal-alvi).
- Added: Option to clear cache of user meta to remove image sizes that do not exist (props @jeffpaul, @ituk, @dinhtungdu, @sparkbold, @thrijith).
- Added: Package file (props @faisal-alvi, @jeffpaul, @claytoncollie, @cadic).
- Added: PHP Unit Tests (props @faisal-alvi, @iamdharmesh).
- Added: “No Response” GitHub Action (props @jeffpaul).
- Changed: Bump WordPress “tested up to” version to 5.9 (props @jeffpaul, @ankitguptaindia, @dinhtungdu, @phpbits).
- Changed: Bump WordPress “tested up to” version to 6.0 (props @ajmaurya99 via #110).
- Changed: Format admin script (props @thrijith, @dinhtungdu).
- Fixed: Media ID as string in REST API (props @diodoe, @dinhtungdu, @dkotter).
- Fixed: Avatar rating text is not translated properly if a user has a custom language Set (props @ActuallyConnor, @faisal-alvi).
- Security: PHP 8 compatibility (props @faisal-alvi, @dkotter, @Sidsector9).
- Security: Bump
rmccue/requests
from 1.7.0 to 1.8.0 (props dependabot@). - Security: Bump
nanoid
from 3.1.28 to 3.2.0 (props dependabot@). - Security: Bump
minimist
from 1.2.5 to 1.2.6 (props dependabot@).
2.2.0 – 2020-10-27
- Added:
$args
parameter toget_simple_local_avatar
function (props @dinhtungdu, @heyjones, @dkotter, @sumnercreations, @dshanske). - Added:
Simple_Local_Avatars::get_avatar_data()
,Simple_Local_Avatars::get_simple_local_avatar_url()
, andSimple_Local_Avatars::get_default_avatar_url()
methods (props @dinhtungdu, @heyjones, @dkotter, @sumnercreations, @dshanske). - Added: Ability to retrieve avatar with
WP_Post
object (props @oscarssanchez, @blobaugh). - Added: class and ID to Avatar section on Profile Page to allow easier styling (props @dinhtungdu).
- Added: WP Acceptance test coverage (props @dinhtungdu).
- Changed: Switched to
pre_get_avatar_data
filter (props @dinhtungdu, @heyjones, @dkotter, @sumnercreations, @dshanske). - Changed:
assign_new_user_avatar
function to public (props @tripflex). - Changed: Split the main class into its own file, added unit tests, and set up testing GitHub action (props @dinhtungdu, @helen, @stevegrunwell).
- Changed: New plugin banner and icon (props @JackieKjome).
- Changed: Bump WordPress version “tested up to” 5.5 (props @Waka867, @tmoorewp, @jeffpaul, @dinhtungdu).
- Changed: GitHub Actions from HCL to YAML workflow syntax (props @jeffpaul).
- Changed: Documentation updates (props @jeffpaul).
- Fixed: Initialize
Simple_Local_Avatars
on the$simple_local_avatars
global, enabling bundling plugin with composer (props @pauldewouters, @adamsilverstein). - Removed:
get_avatar
function that overrides the core function (props @dinhtungdu, @heyjones, @dkotter, @sumnercreations, @dshanske).
2.1.1 – 2019-05-07
- Fixed: Do not delete avatars just because they don’t exist on the local filesystem. This was occasionally dumping avatars when WordPress uploads were stored elsewhere, e.g. a cloud service.
2.1 – 2018-10-24
- New: All avatar uploads now go into the media library. Don’t worry – users without the ability to upload files cannot otherwise see the contents of your media library. This allows local avatars to respect other functionality your site may have around uploaded images, such as external hosting.
- New: REST API support for getting and updating.
- New: Use .org language packs rather than bundling translations.
- Fixed: Avoid an
ArgumentCountError
. - Fixed: A couple of internationalization issues.
2.0 – 2013-06-02
- Choose or upload an avatar from the media library (for users with appropriate capabilities)!
- Local avatars are rated for appropriateness, just like Gravatar
- A new setting under Discussion enables administrators to turn off Gravatar (only use local avatars)
- Delete the local avatar with a single button click (like everywhere else in WordPress)
- Uploaded avatar file names are appended with the timestamp, addressing browser image caching issues
- New developer filter for preventing automatic rescaling: simple_local_avatars_dynamic_resize
- New developer filter for limiting upload size: simple_local_avatars_upload_limit
- Upgraded functions deprecated since WordPress 3.5
- Fixed translations not working on front end (although translations are now a bit out of date…)
- Hungarian translation added (needs further updating again with new version)
- Assorted refactoring / improvements under the hood
1.3.1 – 2011-12-29
- Brazilian Portuguese and Belarusian translations
- Bug fixes (most notably correct naming of image files based on user display name)
- Optimization for WordPress 3.2 / 3.3 (substitutes deprecated function)
1.3 – 2011-09-22
- Avatar file name saved as “user-display-name_avatar” (or other image extension)
- Russian localization added
- Assorted minor code optimizations
1.2.4 – 2011-07-02
- Support for front end avatar uploads (e.g. Theme My Profile)
1.2.3 – 2011-04-04
- Russian localization
1.2.2 – 2011-03-25
- Fix for avatars uploaded pre-1.2.1 having a broken path after upgrade
1.2.1 – 2011-01-26
- French localization
- Simplify uninstall code
1.2 – 2011-01-26
- Fix path issues on some IIS servers (resulting in missing avatar images)
- Fix rare uninstall issues related to deleted avatars
- Spanish localization
- Other minor under the hood optimizations
1.1.3 – 2011-01-20
- Properly deletes old avatars upon changing avatar
- Fixes “foreach” warning in debug mode when updating avatar image
1.1.2 – 2011-01-18
- Norwegian localization
1.1.1 – 2011-01-18
- Italian localization
1.1 – 2011-01-18
- All users (regardless of capabilities) can upload avatars by default. To limit avatar uploading to users with upload files capabilities (Authors and above), check the applicable option under Settings > Discussion. This was the default behavior in 1.0.
- Localization support; German included
1.0 – 2011-01-18
- Initial release.
Fantastic plugin!
Another annoying bug: upload is not protected against uncompatible files (bmp..)
Actually it does. But it accepts jpg, gif, png, bmp, and tif images!
Yes, it’s very possible using the gravatar hooks in WordPress.
Hey, I have changed my permalink settings and the plugin don’t work for avatar admin ??
tthan’sk
Permalink settings have no bearing on this plug-in.
Thanks for this simple plugin.
One question – how do I change the permission to allow everyone to upload an avatar (I am sure it is ABC, but I am new to all this).
Thanks!
The media permissions setting is under Settings > Discussion
I don’t see it. Maybe its not longer in the newest version of WordPress.
You should see it in the latest versions. It’s on the add user / edit user / edit profile screens in the admin dashboard.
Hey! Great work, thanks for this simple and easy plugin.
Just one question: any chance to increase the size of saved avatars? I can’t find the line of code which is responsible for the 96px limitation.
The avatar sizes are generated dynamically when they’re requested, including larger sizes.
Indeed. Awesome, thanks a lot!
Size when requested, how does this work? I want to use the original size of the image, how is that done? How do I call the original image to show on a page?
Er, you don’t. You’d have to get the raw user meta with the avatar, and pull it apart. I believe if you specify a huge size, however, it will only show you “up to” the full size of the avatar.
Hi, I am using your simple local avatars plugin and like it – but need the avatars to be called securely with SSL. Is there a way to do that in the dashboard, or do I need to look at the php file? I have changed the general WP settings to the secure prefixes, but the SLA plugin images are leaving breaking the nice “This site is secure.” Thanks!
Hmm. They should use whatever URL WordPress is using. Did you upload them after changing your WordPress settings to “secure”?
no, before..
should I have? Will that make a difference going
forward?
I uninstalled, deleted the icons, and
reinstalled/reuploaded. All is good again. Thanks.
Genial Plugin, trabaja para mi :D
Thanks Jake for such a wonderful, simple and easy-to-use plugin.
My theme allows users to edit their profile from the font-end and this plugin works perfectly with this capability!
Thanks for your hard work!!! … can’t wait 2 try out your other plugins.
Did you manage to make it upload avatars from the front end?
Hi,
I really like this plug-in but i have some trouble when I’m uploading a avatar from the front end. it’s possibile ?
Can anyone explain how one goes about setting up front end uploading?
It’s enabled with front end profile plug-ins / implementations that reuse the administrative profile form.
Could you elaborate on this a bit? I’ve got a frontend page where users can log in and their meta (and custom meta) is displayed in input fields, and they can change these fields and save their changes. I copy/pasted the bit of your plugin that generates the upload button onto my frontend page and it’s saying “The site is experiencing technical difficulties”.
I’m assuming there’s some dependency that the plugin relies on that isn’t provided on frontend pages. This plugin would be great for my purposes if I could get it working on a frontend page.
Thanks!
Can you help me allow people to upload 3 to 5 profile images but only have the first one show as a replacement Gravitar?
Love your plugin!!!
(^-^)
Glen
Someone could… but I’m keeping this plug-in simple. Feel free to request our services, of course!
GREAT plugin! just a couple of queries… is it possible to specify a directory to upload images to? ie uploads/author-avatars
and, you noted above that the image size is dynamically generated… but I still don’t understand how this works? I need to change my thumbnail output (and filename) to 140px size…. any chance you could help me change that?
Theoretically, an upload folder could be specified. But I personally don’t like the idea of cluttering the uploads folder with new folders; this also makes it trickier to support implementations where uploads is hosted elsewhere.
To request a 140px size, where your theme calls “get_avatar”, you need to specify “140” as the second parameter (the size).
Just like gravatar, if that image size hasn’t been created yet, it will be created (and saved) on the fly when called the first time.
Another Question to resizing:
I am just beginning to work at my homepage, so please excuse my question.
where exact can i change the size?
i guess in simple-local-avatars.php. 100×100 will be fine.
line 268
function get_simple_local_avatar( $id_or_email, $size = ’96’, $default = ”, $alt = false )
here?
I don’t follow. You shouldn’t be editing the plug-in’s code. You call avatars using get_avatar (or get_simple_local_avatar)… use the size parameter to specify your width/height, just like the get_avatar plug-in.
Is it possible to change the filename upon upload to match the username? I am trying to build a consistent format to the uploads so I can pull the avatars in various ways throughout my site.
All in all though, great plugin!
I’ve had a few requests for this, so I’ll probably implement this. You can always loop through users and grab their avatars, however!
This would seem perfect, however, it does not work in my BuddyPress site with a Theme by Themekraft. Although I can upload an image locally to my wp-admin profile (great), it does not show up and I still have the default mystery man (bummer). The front-end profile functionality of the theme also does not refelct the plug in (it uses only gravatars) which might be part of the issue (the src on the mystery man is gravatar). I’m no expert on this stuff and can’t figure out how to resolve, but would love to so let me know if anyone has suggestions!
Not sure why it isn’t showing up after being set in wp-admin. On the front end, BuddyPress (and bbPress) do not use the hooks that the admin uses. I may add support separately.
OK. Then this is what I really want.
How much would it cost to get pages where a user could upload just say 3 to 6 photos on and I can accept/reject/or auto accept them. And have a few text areas, text fields etc where the user could also type what they want on the same page. Also with check boxes to show to everyone or not. Maybe also a 5 start slider a user could select and use.
If the check marks are ticked just regular visitor should be able to see these pages so there probably needs to be a list of users, so sort of top page.
——————-
Name to show everyone:
Age:
Where you live: (drop down choices or other(typing))
Where you like to go: Maybe a Google map *longitude latitude
Message:
My skill level: star star star star star
save
design pic 1 (show to everyone/or not)
design pic 2 (show to everyone/or not)
design pic 3 (show to everyone/or not)
design pic 4 (show to everyone/or not)
design pic 5 (show to everyone/or not)
design pic 6 (show to everyone/or not)
save
text field (show to everyone/or not)
text field (show to everyone/or not)
text field (show to everyone/or not)
text field (show to everyone/or not)
save
text area (show to everyone/or not)
text area (show to everyone/or not)
text area (show to everyone/or not)
text area (show to everyone/or not)
save
Please use the contact page to get estimates for project work. It’s all very doable, but won’t be part of this plug-in!
Hi Jake. Great plugin!
I was wondering if you might be able to point me in the right direction with something. I have created a custom wp_insert_post form for registered users. I was wondering how I could attach the user’s avatar to the post as the post’s thumbnail?
I imagine I would have to update_post_meta, but how do I point to their image? Any help would be greatly appreciated. Thanks!
The post thumbnail feature uses the attachment post ID… the way avatars are uploaded, they are not added into the posts table. To make this work, you’d need to hook in and make them attachments, or hook the featured image functionality and override its behavior. Neat idea, but no easy answer, unfortunately!
Hi,
great plugin, but something just doesn’t work out for me…
I’m using it with WP 3.2.1 German and after uploading an pic (.jpg) and clicking “Update Profile” (took some time til I figured how to apply the new pic… ;-D) it doesn’t show… Do I have to set rights somewhere?
Thanks in advance!
I’m a newbie and have searched forums…can’t figure out how to make the photo smaller with this plugin. It’s probably something simple but I can’t figure it out. Thanks!
Figured it out…nice plugin…now. :-)
Thanks much!!