Coder Social home page Coder Social logo

10up / simple-local-avatars Goto Github PK

View Code? Open in Web Editor NEW
202.0 57.0 40.0 3.05 MB

Adds an avatar upload field to user profiles. Generates requested sizes on demand just like Gravatar!

Home Page: https://wordpress.org/plugins/simple-local-avatars/

License: GNU General Public License v2.0

JavaScript 22.41% PHP 77.47% Shell 0.12%
wordpress local-avatars avatars

simple-local-avatars's People

Contributors

actuallyconnor avatar barneyjeffries avatar bhargavbhandari90 avatar claytoncollie avatar dependabot[bot] avatar dinhtungdu avatar dkotter avatar eflorea avatar faisal-alvi avatar firestorm980 avatar github-actions[bot] avatar helen avatar iamdharmesh avatar jakemgold avatar jayedul avatar jeffpaul avatar kmgalanakis avatar mattheu avatar mehulkaklotar avatar ocean90 avatar peterwilsoncc avatar rahulsprajapati avatar ravinderk avatar sidsector9 avatar stevegrunwell avatar t-lock avatar thrijith avatar vladolaru avatar waka867 avatar zamanq avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

simple-local-avatars's Issues

Add unit tests

Distributed plugins tend to benefit from unit tests, especially as we start refactoring this code (some of which is 5 years old).

Work has begun in the feature/tests branch.

Release version 2.4.0

Is your enhancement related to a problem? Please describe.

This issue is for tracking changes for the 2.4.0 release. Target release date: TBD - Mid May 2022.

Release steps

  • Branch: Starting from develop, cut a release branch named release/2.4.0 for your changes.
  • Version bump: Bump the version number in package.json, readme.txt, and simple-local-avatars.php if it does not already reflect the version being released.
  • Changelog: Add/update the changelog in CHANGELOG.md and readme.txt.
  • Props: update CREDITS.md with any new contributors, confirm maintainers are accurate.
  • New files: Check to be sure any new files/paths that are unnecessary in the production version are included in .distignore.
  • Readme updates: Make any other readme changes as necessary. README.md is geared toward GitHub and readme.txt contains WordPress.org-specific content. The two are slightly different.
  • Merge: Make a non-fast-forward merge from your release branch to develop (or merge the pull request), then do the same for develop into trunk (git checkout trunk && git merge --no-ff develop). trunk contains the latest stable release.
  • Test: Run through common tasks while on trunk to be sure it functions correctly.
  • Push: Push your trunk branch to GitHub (e.g. git push origin trunk).
  • Release: Create a new release, naming the tag and the release with the new version number, and targeting the trunk branch. Paste the changelog from CHANGELOG.md into the body of the release and include a link to the closed issues on the milestone.
  • SVN: Wait for the GitHub Action to finish deploying to the WordPress.org repository. If all goes well, users with SVN commit access for that plugin will receive an emailed diff of changes.
  • Check WordPress.org: Ensure that the changes are live on https://wordpress.org/plugins/simple-local-avatars/. This may take a few minutes.
  • Close the milestone: Edit the milestone with the release date (in the Due date (optional) field) and link to the GitHub release (in the Description field), then close the milestone.
  • Punt incomplete items: If any open issues or PRs which were milestoned for 2.4.0 do not make it into the release, update their milestone to the next milestone, or Future Release.

Designs

No response

Describe alternatives you've considered

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct

Breaks wordpress functions: get_avatar and get_avatar_url

Thanks for the great work on this plugin!

However, I have encountered a fairly critical bug:

Describe the bug
The core wordpress function get_avatar() works nicely with simple-local-avatars, unless you need to use additional functionality like adding a class or another custom attribute.

Steps to Reproduce

  1. Use theme code: <?= get_avatar(get_current_user_id(), 96, "", "", array('class' => "my-class", 'extra_attr' => 'data-id="1234"')) ?> without simple-local-avatars activated.
  2. Load the page, inspect front end, notice that the class and data-attr are present
  3. Activate simple-local-avatars
  4. Load the page, inspect front end, notice that the class and data-attr are no longer present

Expected behavior
All arguments/features from wordpress' core function get_avatar should work with simple-local-avatars. For the full list, see: https://developer.wordpress.org/reference/functions/get_avatar/

This bug prevents simple-local-avatars from being a no-code drop-in replacement for gravatar, on themes that use the full functionality of get_avatar()

Test against WordPress 5.8

Is your enhancement related to a problem? Please describe.
Once WordPress 5.8 is released, we'll want to test Simple Local Avatars to see if any incompatibility issues arise.

Describe the solution you'd like

  • test Simple Local Avatars on WordPress 5.8
  • open issues for any incompatibilities noted in testing
  • resolve issues identified in testing
  • bump "tested up to" version
  • if code changes needed due to incompatibilities, ship a plugin release, otherwise use "Plugin asset/readme update" action to update "tested up to" version on .org repo

Designs
n/a

Describe alternatives you've considered
none

Additional context
Related: #56, #66, #70.

Upload image / photo, rest worpress api is possible?

Hello, is it possible to send photos through wordpress rest api to a specific endpoint?
I see that in return when doing get to users/1
I have the return of simple_local_avatar as an object, but I don't know how to send the image.
I'm using Ionic/Angular on the front.
Can you guide me?

Ask: when set avatar image - image not shows (media / upload)

Hi,

Apologies, are there anything i can check when i use the simple-local-avatars when set the image avatar for the profile user it wont show for the image instead only white background like below image screenshot
image

  • When i used custom theme does it a must to use get_avatar function php in my theme to make it works ?
  • Let say when i use this simple-local-avatars plugin when i uploaded image for avatar for specific profile it should be create a file image in Uploads folder isnt ? if not created - are there anything i can check (assumed i set directory of uploads for 750 & www-data user)

Again many thanks for your help & sorry for this question.

Local Avatar with S3 Offloaded not correct image url

Describe your question

Hello,
I'm using Simple Local Avatar with all media offloaded to S3 with WP Offload Media by DELICIOUS BRAINS after offloaded all media all image in avatar are broke I'm inspected in img tag of avatar it's show something like this:
<img alt="" src="https://ams.com.kh/central/s3://central/media/Heng-Sambath-116x116.png" srcset="https://ams.com.kh/central/s3://central/media/Heng-Sambath-232x232.png 2x" class="avatar avatar-116" height="116" width="116" loading="lazy">
It's should be like this:
<img alt="" src="https://asset.ams.com.kh/central/media/Heng-Sambath-116x116.png" srcset="https://asset.ams.com.kh/central/media/Heng-Sambath-232x232.png 2x" class="avatar avatar-116" height="116" width="116" loading="lazy">
All media working fine every where only in Avatar that not work there's any help?
Thank you

Code of Conduct

  • I agree to follow this project's Code of Conduct

ssl problem

images dont work on dashboard in https (frontpage is working)

Preview is not getting generated for Subscriber user

Is your enhancement related to a problem? Please describe.

Subscriber user is unable to see the preview of avatar after uploading in profile. They have to Save setting and then can see the preview.

Describe the solution you'd like

Would be great if allow same behaviour as other user roles like Editor, Admin

Additional context

This issue is causing due to user role capability as Subscriber doesn't have Media Library option to select Image.
Subscriber user always has to select image from computer.

If user selecting image from Media library then preview is automatically generated but if user selecting image from local storage of computer then preview is not getting generated.

Video Explanation- http://somup.com/crfQjvb8fD

Subscriber User screen -
Screenshot 2021-04-09 at 2 05 40 PM

Admin User screen -
Screenshot 2021-04-09 at 2 06 08 PM

Add Settings link after activation and associated settings screenshot + copy

Is your enhancement related to a problem? Please describe.
Originally reported on WordPress.org:

Also most Plugins that have a settings page would have a settings link in the Plugins page underneath it’s name and this does not making it hard to find where the settings page is, but the author does explain this in their documentation.

Describe the solution you'd like
After installing SLA, there's no direction of where to find any admin settings. Let's look to add a "Settings" link under the plugin name on the Installed Plugins page (e.g. wp-admin/plugins.php) that links to wp-admin/options-discussion.php to better help direct admins on where to customize their SLA experience. Let's also add a screenshot of this setting with particular focus on the SLA settings and ensure the screenshot copy notes this is where the plugin settings reside.

Designs
n/a

Describe alternatives you've considered
keep as-is, possibly just adding a screenshot and copy to point out where the admin settings reside.

Additional context
Ensure that any PR and associated release that adds this to SLA credits @ggedde / https://profiles.wordpress.org/ggedde/ for the inspiration on this.

readme updates

Is your enhancement related to a problem? Please describe.
It's not obvious the level of support provided for this repo, so let's add some clarification.

Describe the solution you'd like

  • add version badge
  • add support level section & badge
  • add license badge

Designs
n/a

Describe alternatives you've considered
none.

Additional context
n/a

Incompatibility with Elementor

Describe the bug
Previously reported on WordPress.org:

It doesn’t work with Elementor PRO?

Steps to Reproduce
First report:

I tested the plugin on an author box built with Elementor, but the Gravatar is not shown.
It would be good to check why, due to the popularity of Elementor.

Second report:

I’m facing the same issue with elementor pro. I’m trying to use Simple Local Avatars for my profile avatar then I tried to use it with the dynamic content available in elementor pro, but the profile picture doesn’t show up when I select the profile picture in the dynamic section.

Expected behavior

Screenshots

Environment information

  • Device:
  • OS:
  • Browser and version:
  • Simple Local Avatars version:
  • Theme and version:
  • Other installed plugin(s) and version(s): WordPress 5.4.1 and Elementor Pro 2.9.5

Additional context

Test against WordPress 5.7

Is your enhancement related to a problem? Please describe.
Once WordPress 5.7 is released, we'll want to test Simple Local Avatars to see if any incompatibility issues arise.

Describe the solution you'd like

  • test Simple Local Avatars on WordPress 5.7
  • open issues for any incompatibilities noted in testing
  • resolve issues identified in testing
  • bump "tested up to" version
  • if code changes needed due to incompatibilities, ship a plugin release, otherwise use "Plugin asset/readme update" action to update "tested up to" version on .org repo

Designs
n/a

Describe alternatives you've considered
none

Additional context
Related: #56, #66.

Option to prevent media deletion

Is your enhancement related to a problem? Please describe.
We received the following from @ZalemCitizen on WordPress.ORG:

Hello,

I find hard that the only way to remove avatar from user is to use ‘delete local avatar’ button which deletes completely avatar image.
I need to remove avatar choice from user but keep the file in Media library because it may be used elsewhere.

Could you add a simple cross or button to break link between user and media object ?

Describe the solution you'd like

Ability to select "delete" or "remove" local avatar where "delete" completely deletes the image and "remove" retains the image file in the media library and just disassociates it from the user.

Designs

Describe alternatives you've considered

Additional context

Test against WordPress 5.6

Is your enhancement related to a problem? Please describe.
Once WordPress 5.6 is released, we'll want to test Simple Local Avatars to see if any incompatibility issues arise.

Describe the solution you'd like

  • test Simple Local Avatars on WordPress 5.6
  • open issues for any incompatibilities noted in testing
  • resolve issues identified in testing
  • bump "tested up to" version
  • if code changes needed due to incompatibilities, ship a plugin release, otherwise use "Plugin asset/readme update" action to update "tested up to" version on .org repo

Designs
n/a

Describe alternatives you've considered
none

Additional context
WordPress 5.5 testing issue --> #56

Crop area does not appear sometimes.

Describe the bug

The avatar crop feature was recently introduced in #83. It is noted that the crop area does not appear sometimes. Also noticed the behavior - when changing a window size slightly, the crop area appears!

Steps to Reproduce

  1. Upload a wide image and keep the window size narrow or vice versa.
  2. Try to select and crop the image.
  3. The crop area does not appear.
  4. Slightly change the window size.
  5. Crop are appears.
  6. Check the below video.

Screenshots, screen recording, code snippet

https://www.screencast.com/t/PhQmfpPL7dO7

Environment information

` ### wp-core ###

version: 5.9.1
site_language: en_US
user_language: en_US
timezone: Asia/Kolkata
permalink: /%postname%/
https_status: true
multisite: false
user_registration: 0
blog_public: 1
default_comment_status: open
environment_type: local
user_count: 11
dotorg_communication: true

wp-paths-sizes

wordpress_path: /Users/faisalalvi/LocalSites/wpne/app/public
wordpress_size: 43.74 MB (45862139 bytes)
uploads_path: /Users/faisalalvi/LocalSites/wpne/app/public/wp-content/uploads
uploads_size: 6.46 MB (6776453 bytes)
themes_path: /Users/faisalalvi/LocalSites/wpne/app/public/wp-content/themes
themes_size: 6.47 MB (6780262 bytes)
plugins_path: /Users/faisalalvi/LocalSites/wpne/app/public/wp-content/plugins
plugins_size: 2.91 GB (3122292916 bytes)
database_size: 47.20 MB (49496064 bytes)
total_size: 3.01 GB (3231207834 bytes)

wp-active-theme

name: Twenty Twenty-One (twentytwentyone)
version: 1.4 (latest version: 1.5)
author: the WordPress team
author_website: https://wordpress.org/
parent_theme: none
theme_features: core-block-patterns, wc-product-gallery-zoom, wc-product-gallery-lightbox, wc-product-gallery-slider, woocommerce, widgets-block-editor, post-thumbnails, automatic-feed-links, title-tag, post-formats, menus, html5, custom-logo, customize-selective-refresh-widgets, wp-block-styles, align-wide, editor-styles, editor-style, editor-font-sizes, custom-background, editor-color-palette, editor-gradient-presets, responsive-embeds, custom-line-height, experimental-link-color, custom-spacing, custom-units, widgets
theme_path: /Users/faisalalvi/LocalSites/wpne/app/public/wp-content/themes/twentytwentyone
auto_update: Disabled

wp-themes-inactive (10)

Newspack Joseph: version: 1.0.0-alpha.33, author: Automattic, Auto-updates disabled
Newspack Katharine: version: 1.0.0-alpha.33, author: Automattic, Auto-updates disabled
Newspack Nelson: version: 1.0.0-alpha.33, author: Automattic, Auto-updates disabled
Newspack Sacha: version: 1.0.0-alpha.33, author: Automattic, Auto-updates disabled
Newspack Scott: version: 1.0.0-alpha.33, author: Automattic, Auto-updates disabled
Newspack: version: 1.53.2, author: Automattic, Auto-updates disabled
Storefront: version: 3.9.1, author: Automattic, Auto-updates disabled
Twenty Nineteen: version: 2.1, author: the WordPress team (latest version: 2.2), Auto-updates disabled
Twenty Twenty: version: 1.8, author: the WordPress team (latest version: 1.9), Auto-updates disabled
Twenty Twenty-Two: version: 1.0, author: the WordPress team (latest version: 1.1), Auto-updates disabled

wp-mu-plugins (1)

ngrok.php: author: (undefined), version: (undefined)

wp-plugins-active (4)

10up Block Library: version: 1.0.1, author: 10up, Auto-updates disabled
Simple Local Avatars: version: 2.2.0, author: Jake Goldman, 10up, Auto-updates disabled
WooCommerce: version: 5.9.0, author: Automattic (latest version: 6.2.1), Auto-updates disabled
WooCommerce Bookings: version: 1.15.52, author: WooCommerce, Auto-updates disabled

wp-plugins-inactive (40)

Accessibility CheckUp: version: 1.2.0, author: 10up, Auto-updates disabled
Ads.txt Manager: version: 1.3.0, author: 10up, Auto-updates disabled
AMP: version: 2.1.4, author: AMP Project Contributors (latest version: 2.2.1), Auto-updates disabled
Block for Apple Maps: version: 1.0.1, author: 10up (latest version: 1.0.2), Auto-updates disabled
Bookings Generator: version: 1.0.0, author: WooCommerce, Auto-updates disabled
Bookings Helper: version: 1.0.3, author: WooCommerce, Auto-updates disabled
Distributor: version: 1.6.7, author: 10up Inc., Auto-updates disabled
Dokan: version: 3.3.2, author: weDevs (latest version: 3.3.9), Auto-updates disabled
Jetpack: version: 10.3, author: Automattic (latest version: 10.6), Auto-updates disabled
Members: version: 3.1.7, author: MemberPress, Auto-updates disabled
Newspack: version: 1.67.0-alpha.2, author: Automattic, Auto-updates disabled
Newspack Blocks: version: 1.42.1, author: Automattic, Auto-updates disabled
Newspack Newsletters: version: 1.36.1, author: Automattic (latest version: 1.41.0), Auto-updates disabled
ProfilePress: version: 3.2.8, author: ProfilePress Team, Auto-updates disabled
Publisher Media Kit: version: 1.0.0, author: 10up, Auto-updates disabled
PWA: version: 0.6.0, author: PWA Plugin Contributors, Auto-updates disabled
Query Monitor: version: 3.7.1, author: John Blackbourn (latest version: 3.8.2), Auto-updates disabled
Repeat Order for Woocommerce: version: 1.2.0, author: polyres, Auto-updates disabled
Restricted Site Access: version: 7.2.0, author: Jake Goldman, 10up, Oomph (latest version: 7.3.0), Auto-updates disabled
Simple Podcasting: version: 1.2.0, author: 10up (latest version: 1.2.1), Auto-updates disabled
Site Kit by Google: version: 1.45.0, author: Google (latest version: 1.69.0), Auto-updates disabled
User Switching: version: 1.5.8, author: John Blackbourn & contributors, Auto-updates disabled
W3 Total Cache: version: 2.1.9, author: BoldGrid (latest version: 2.2.1), Auto-updates disabled
WooCommerce Accommodation Bookings: version: 1.1.26, author: WooCommerce, Auto-updates disabled
WooCommerce Amazon Pay: version: 2.1.1, author: WooCommerce, Auto-updates disabled
WooCommerce Blocks: version: 7.1.0-dev, author: Automattic, Auto-updates disabled
WooCommerce Bookings Availability: version: 1.1.19, author: WooCommerce, Auto-updates disabled
WooCommerce Deposits: version: 1.5.8, author: WooCommerce, Auto-updates disabled
WooCommerce EU VAT Number: version: 2.4.1, author: WooCommerce, Auto-updates disabled
WooCommerce Memberships: version: 1.22.1, author: SkyVerge, Auto-updates disabled
WooCommerce Multi-currency: version: 2.14.3, author: TIV.NET INC, Auto-updates disabled
WooCommerce Pre-Orders: version: 1.6.0, author: WooCommerce, Auto-updates disabled
WooCommerce Product Add-ons: version: 4.7.0, author: WooCommerce, Auto-updates disabled
WooCommerce Product Vendors: version: 2.1.58, author: WooCommerce, Auto-updates disabled
WooCommerce Square: version: 2.9.0, author: WooCommerce, Auto-updates disabled
WooCommerce Stripe Gateway: version: 6.1.0, author: WooCommerce (latest version: 6.2.0), Auto-updates disabled
WooCommerce Xero Integration: version: 1.7.41, author: WooCommerce, Auto-updates disabled
WP Crontrol: version: 1.12.0, author: John Blackbourn & crontributors, Auto-updates disabled
XT Quick View for WooCommerce: version: 1.9.4, author: XplodedThemes (latest version: 1.9.5), Auto-updates disabled
Yoast SEO: version: 17.6, author: Team Yoast (latest version: 18.2), Auto-updates disabled

wp-media

image_editor: WP_Image_Editor_GD
imagick_module_version: Not available
imagemagick_version: Not available
imagick_version: Not available
file_uploads: File uploads is turned off
post_max_size: 1000M
upload_max_filesize: 300M
max_effective_size: 300 MB
max_file_uploads: 20
gd_version: bundled (2.1.0 compatible)
gd_formats: GIF, JPEG, PNG, BMP
ghostscript_version: not available

wp-server

server_architecture: Darwin 21.3.0 x86_64
httpd_software: nginx/1.16.0
php_version: 7.3.5 64bit
php_sapi: fpm-fcgi
max_input_variables: 4000
time_limit: 1200
memory_limit: 256M
max_input_time: 600
upload_max_filesize: 300M
php_post_max_size: 1000M
curl_version: 7.77.0 (SecureTransport) LibreSSL/2.8.3
suhosin: false
imagick_availability: false
pretty_permalinks: true
htaccess_extra_rules: false

wp-database

extension: mysqli
server_version: 8.0.16
client_version: mysqlnd 5.0.12-dev - 20150407 - $Id: 7cc7cc96e675f6d72e5cf0f267f48e167c2abb23 $
max_allowed_packet: 16777216
max_connections: 151

wp-constants

WP_HOME: undefined
WP_SITEURL: undefined
WP_CONTENT_DIR: /Users/faisalalvi/LocalSites/wpne/app/public/wp-content
WP_PLUGIN_DIR: /Users/faisalalvi/LocalSites/wpne/app/public/wp-content/plugins
WP_MEMORY_LIMIT: 40M
WP_MAX_MEMORY_LIMIT: 256M
WP_DEBUG: true
WP_DEBUG_DISPLAY: true
WP_DEBUG_LOG: false
SCRIPT_DEBUG: true
WP_CACHE: false
CONCATENATE_SCRIPTS: undefined
COMPRESS_SCRIPTS: undefined
COMPRESS_CSS: undefined
WP_ENVIRONMENT_TYPE: local
DB_CHARSET: utf8
DB_COLLATE: undefined

wp-filesystem

wordpress: writable
wp-content: writable
uploads: writable
plugins: writable
themes: writable
mu-plugins: writable

`

WordPress information

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct

Implement `get_avatar_url` the same as `get_avatar`

Is your enhancement related to a problem? Please describe.
Yes, currently you can get the avatar from simple local avatars by calling get_avatar and passing the appropriate arguments. We would like to be able to do the same thing with get_avatar_url. Specifically in our case the issue is that the WPGraphQL plugin uses the get_avatar_url to populate the avatar field when requesting user information. When this happens we only get back the default Gravatar icons and not the simple local avatar that we have created.

Describe the solution you'd like
We would like to be able to use the simple local avatars with our GraphQL and in order to do that we need to have get_avatar_url use simple local avatars as well

Describe alternatives you've considered
We could also override the get_avatar_url filter in our functions file of the theme. We'd prefer to not do that since that ties our theme very tightly to this plugin. It also feels more correct to have the plugin return the URL when calling get_avatar_url

Additional context
Additionally if get_avatar_url returns the url then the get_avatar function could call that to get the appropriate URL to add to the src

Test against WordPress 5.5

Is your enhancement related to a problem? Please describe.
Once WordPress 5.5 is released, we'll want to test Simple Local Avatars to see if any incompatibility issues arise.

Describe the solution you'd like

  • test Simple Local Avatars on WordPress 5.5
  • open issues for any incompatibilities noted in testing
  • resolve issues identified in testing
  • bump "tested up to" version
  • if code changes needed due to incompatibilities, ship a plugin release, otherwise use "Plugin asset/readme update" action to update "tested up to" version on .org repo

Designs
n/a

Describe alternatives you've considered
none

Additional context
WordPress 5.4 testing issue --> #42

Adapt to More Current Avatar Filters

Is your enhancement related to a problem? Please describe.
Simple Local Avatars hooks into the get_avatar filter. However, there are better options introduced after initial creation of this plugin.

Describe the solution you'd like
Introduced in 4.2.0, get_avatar_data returns an array of arguments. This seems better than the #19 solution.

The pre_get_avatar filter seems best. It can check for the presence of a user_id or an object with one, and if not return control to other code.

It is more involved to implement, but it would make for a massive improvement and would support things like srcset, which the plugin currently overrides and ignores. It is also better for future proofing. It would allow the removal of redundant code as well.

Describe alternatives you've considered
Leaving it as is?

Additional context
The minimum requirement is WordPress 4.6, so there is no compatibility issue

Avatar randomnly removed

Randomly the avatar disappears (the usermeta "simple_local_avatar" is being removed from database).

Tracking it down to https://github.com/10up/simple-local-avatars/blob/develop/simple-local-avatars.php#L97 might be the issue. There is logic in there when getting the avatar to auto-clean it if cannot be found if a WP user is logged in.
So what happens I believe is that get_attached_file fails (filesystem not available - maybe some use of S3, Azure storage plugins) so the avatar is removed.

So maybe a fix would be either remove the auto-clean, check filesystem is accessible before check file exists or add some sort of setting that enables/disables this.

Test against WordPress 6.0

Is your enhancement related to a problem? Please describe.
Once WordPress 6.0 is released, we'll want to test Simple Local Avatars to see if any incompatibility issues arise.

Describe the solution you'd like

  • test Simple Local Avatars on WordPress 6.0
  • open issues for any incompatibilities noted in testing
  • resolve issues identified in testing
  • bump "tested up to" version
  • if code changes needed due to incompatibilities, ship a plugin release, otherwise use "Plugin asset/readme update" action to update "tested up to" version on .org repo

Designs
n/a

Describe alternatives you've considered
none

Additional context
Related: #66, #56, #42, #35

avatars are being deleted after thumbnail regenarting

after regenerating all thumbnails in site and wiping unnecessary images (using Regenerate Thumbnails plugin), some avatars thumbnail where deleted. so...

  1. is there a way to regenerate them? the original files are still there, only the cropped ones are gone.
  2. there must a be a way to prevent things like that from happening. maybe registering the avatars as image_size?

Retrieving avatar fails when using WP_Post

When calling get_avatar() and passing in a WP_Post object Simple Local Avatars fails to properly pick up the user id. This is because the core get_avatar() supports more methods of finding the user id than the plugin's get_avatar().

Example code (where $post is the global on a single view):
$avatar = get_avatar( $post, '72' )

You can see all the types supported by core at
https://github.com/WordPress/WordPress/blob/master/wp-includes/link-template.php#L4091

  • Number
  • String
  • WP_User
  • WP_Post
  • WP_Comment

Support in the plugins is at
https://github.com/10up/simple-local-avatars/blob/develop/simple-local-avatars.php#L66

  • Number
  • String
  • Generic object with post_id property

Test against WP 5.4

Is your enhancement related to a problem? Please describe.
Once WordPress 5.4 is released, we'll want to test Simple Local Avatars to see if any incompatibility issues arise.

Describe the solution you'd like

  • test Simple Local Avatars on WP 5.4
  • open issues for any incompatibilities noted in testing
  • resolve issues identified in testing
  • bump "tested up to" version
  • if code changes needed due to incompatibilities, ship a plugin release, otherwise use "Plugin asset/readme update" action to update "tested up to" version on .org repo

Designs
n/a

Describe alternatives you've considered
none

Additional context
none

Deprecate direct uploads

Coming out of discussions with @jakemgold, I think we should deprecate direct uploads. Currently, the plugin allows users without the capability to upload media (subscribers and contributors by default) to still upload avatars, with an option to turn that off. These do not go into the media library but rather directly into the uploads directory. This creates issues for sites that store attachments outside of WP, (see #11 / #14).

I think the biggest question here is whether the plugin should retain its current default behavior of allowing everybody to upload or if we should switch the option for new installs. I think the latter may prove difficult if not outright impossible because there is no guarantee of being able to detect what's an existing install. If we allow everybody to upload, we should be sure that non-privileged users are only able to view/edit their own uploads.

The other thing we need to ensure is that existing directly uploaded avatars continue to work when requested and in the admin as far as being shown and deleted.

One interesting side effect that might be a net positive is that now all avatars can be viewed in the media library, making it easy to delete a bunch if necessary (e.g. moderation/review). It wouldn't remove the user meta reference but it would at least make the image unavailable.

Test against WordPress 5.9

Is your enhancement related to a problem? Please describe.

Describe the solution you'd like

  • test WP New Relic on WordPress 5.9
  • open issues for any incompatibilities noted in testing
  • resolve issues identified in testing
  • bump "tested up to" version
  • if code changes needed due to incompatibilities, ship a plugin release, otherwise use "Plugin asset/readme update" action to update "tested up to" version on .org repo

Designs
n/a

Describe alternatives you've considered
None

Additional context

Add ability to crop images before setting as avatar

Is your enhancement related to a problem? Please describe.
Originally reported on WordPress.org support forum:

I’ve used this plugin foe a few years and love it. One feature I do miss is the ability to crop the avatars myself. Often the automatic crop just doesn’t look great, so I’ll have to do it myself on my PC and re-upload.

Alternatively, I could set a custom media size and use a different plugin to crop the images, if it’d be possible to point the avatar to use that size.

(Also, I ditto the other suggestion in this forum about making it easier to move domains with the plugin. I’m about to move my website and didn’t realize it’d mean I’d have to start from scratch with my user avatars…)

Thank you for this plugin!

Describe the solution you'd like
Follow the core flow of supporting crop when selecting an image for an avatar.

Designs
n/a

Describe alternatives you've considered
none

Additional context
n/a

Ensure avatars work correctly on a network install

Description

I would expect that the plugin would work on a network install.

Actual results

On a network install, after setting an avatar for my user, WordPress continued to use my gravatar instead.

Wrong avatar URLs for multisite network configured avatars

Describe the bug

When local avatars are shared and configured at the network level, the avatar URLs used on the frontend are broken. They end up with the site URL prepended to the absolute path of the avatar thumbnail.

This only happens for non-standard thumbnail sizes (e.g. 100). Standard sizes (e.g. 96) work fine.

Steps to Reproduce

  1. Activate the plugin network-wide and activate shared avatars through the Shared network avatars options.
  2. Go to the network dashboard
  3. Go to Users
  4. Edit the avatar of a user
  5. Go to a post with comments by that user, using a theme that outputs non-standard avatar sizes (like 100).

Screenshots, screen recording, code snippet

No response

Environment information

No response

WordPress information

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct

Add to Packagist

Can we get this added to Packagist real quick? Looks like it never was and I'd prefer to bring it in via Composer.

Thanks!

Setup Cypress for E2E testing

Is your enhancement related to a problem? Please describe.

See overall concept in the OSBP guide and example setups on Simple Podcasting, Restricted Site Access, and 10up/ElasticPress#2446.

Describe the solution you'd like

  • add base GitHub Action
  • add .wp-env.json
  • add base docker files
  • update package.json / package lock files
  • add cypress tests
  • remove any WP Acceptance components

Designs

n/a

Describe alternatives you've considered

n/a

Additional context

https://github.com/10up/cypress-wp-setup/ && https://github.com/10up/cypress-wp-utils will be helpful in getting this spun up and some initial test commands to leverage.

Ensure alt text is output when the avatar image is output

Describe the bug

If an author has a local avatar set and the image used for that avatar has custom alt text set, it doesn't appear that we ever use that alt text (see this report). WordPress already supports outputting the alt text on the avatar image tag if that exists, so we just need to ensure that if someone has a local avatar set, let's grab the alt text for that image and return that in the image arguments.

Steps to Reproduce

  1. Upload a new image and add alt text to it
  2. Assign that image as a local avatar to a user
  3. Create a post with that same user
  4. View the post on the front-end and see the avatar being output but no alt text

Screenshots, screen recording, code snippet

No response

Environment information

No response

WordPress information

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct

Setup Cypress E2E tests

Is your enhancement related to a problem? Please describe.

Setup Cypress for E2E tests by using the Cyress setup tool. Also, add Github actions.

Designs

No response

Describe alternatives you've considered

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct

Apply a proper maximum file size restriction

Describe the solution you'd like
I'd like to be able to set a maximum upload size (100kb for example) so that my users don't upload a 10mb image.


Underlying problem

This has been suggested and appears that there's some code to deal with it:

add_filter( 'upload_size_limit', array( $this, 'upload_size_limit' ) );

But it does not work, as it bypasses the Wordpress maximum filesize checking. Even defining on the global wordpress filter

add_filter( 'upload_size_limit', 'my_upload_size_limit', 10, 3);
function my_upload_size_limit($i1, $i2, $i3) {
	return 100;
}

This last block Limits the Media upload page, but it does not restricts the Simple Local Avatar way of upload, since it calls directly media_handle_upload, which does not check for file size.


Proposed solution

A proper way to solve this would be similar to what you have here

if ( false !== strpos( $_FILES['simple-local-avatar']['name'], '.php' ) ) {
but instead doing something like this

if ( $_FILES['simple-local-avatar']['size'] > DEFINED_SIZE_IN_BYTES ) ) {
	//throw error here;
	return;
}

Of course, you could just hook the previous filter to get the information. I can submit a PR, but this is a really simple check, just need proper error throwing.

Release version 2.3.0

Is your enhancement related to a problem? Please describe.

This issue is for tracking changes for the 2.3.0 release. Target release date: TBD April 2022.

Pre-Release steps

Release steps

  • Branch: Starting from develop, cut a release branch named release/2.3.0 for your changes.
  • Version bump: Bump the version number in package.json, readme.txt, and simple-local-avatars.php if it does not already reflect the version being released.
  • Changelog: Add/update the changelog in CHANGELOG.md and readme.txt.
  • Props: update CREDITS.md with any new contributors, confirm maintainers are accurate.
  • New files: Check to be sure any new files/paths that are unnecessary in the production version are included in .gitattributes.
  • Readme updates: Make any other readme changes as necessary. README.md is geared toward GitHub and readme.txt contains WordPress.org-specific content. The two are slightly different.
  • Merge: Make a non-fast-forward merge from your release branch to develop (or merge the pull request), then do the same for develop into trunk (git checkout trunk && git merge --no-ff develop). trunk contains the latest stable release.
  • Test: Run through common tasks while on trunk to be sure it functions correctly.
  • Push: Push your trunk branch to GitHub (e.g. git push origin trunk).
  • Release: Create a new release, naming the tag and the release with the new version number, and targeting the trunk branch. Paste the changelog from CHANGELOG.md into the body of the release and include a link to the closed issues on the milestone.
  • SVN: Wait for the GitHub Action to finish deploying to the WordPress.org repository. If all goes well, users with SVN commit access for that plugin will receive an emailed diff of changes.
  • Check WordPress.org: Ensure that the changes are live on https://wordpress.org/plugins/simple-local-avatars/. This may take a few minutes.
  • Close the milestone: Edit the milestone with the release date (in the Due date (optional) field) and link to the GitHub release (in the Description field), then close the milestone.
  • Punt incomplete items: If any open issues or PRs which were milestoned for 2.3.0 do not make it into the release, update their milestone to 2.3.0, or Future Release.

Crop changes: skip cropping; allow non-square crops

Is your enhancement related to a problem? Please describe.

In #65 it was requested that we add the ability to choose how an image is cropped (implemented in #83). But there are times when someone uploads an image that is the exact size they need and they should be able to bypass the cropping. Right now, the only option you have is to choose a crop.

I think ideal here would be to have a a Skip cropping button, similarly to how the site icon is handled.

Screen Shot 2022-05-13 at 9 45 08 AM

In addition, it seems we force the image to always be a square (which was requested here). Is there a reason why we need to force this image to always be a square? Again, using the idea of the site icon, it gives you a pre-defined crop area but than you can change that crop to be whatever size you want. I guess I'd argue we should allow that flexibility instead of forcing a square crop.

Designs

No response

Describe alternatives you've considered

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct

Incorecct Location of admin.js

Describe the bug

Looking at the GitHub source, /assets/js/admin.js exists, but in the trunk of wp.org: https://plugins.svn.wordpress.org/simple-local-avatars/trunk/

See https://github.com/10up/simple-local-avatars/blob/develop/includes/class-simple-local-avatars.php#L1189

So getting a 404 on all admin pages. Also, shouldn't this only be loaded on the settings page too?

Looks like a distignore issue: https://github.com/10up/simple-local-avatars/blob/develop/.distignore#L5

Steps to Reproduce

  1. Visit admin, installed from dot org.
  2. Note admin 404 requests to asset file.
  3. Or visit code and see missing /assets directory.

Screenshots, screen recording, code snippet

No response

Environment information

No response

WordPress information

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct

Allow import from WP User Avatar / ProfilePress

Is your enhancement related to a problem? Please describe.
As seen on WP.org, folks are migrating to Simple Local Avatars from WP User Avatar / ProfilePress and looking for help migrating in their users avatars.

Describe the solution you'd like
Leverage Gist to help script this migration (properly crediting the author of course).

Designs
Possibly include an “Import settings from…” option in settings to import settings from competing plugins starting with WP User Avatar.

Describe alternatives you've considered

Additional context

Avatar rating text is not translated properly if a user has a custom language set

Describe the bug
Reported here. The Avatar Rating text is translated properly if a site language is set but not if a user language is set.

Looking into it, I believe it's related to this: https://make.wordpress.org/core/2016/11/07/changed-loading-order-for-current-user-in-4-7/. Basically where we have those strings set is loaded prior to the user object being initialized, so the user's set language is never available and thus won't be considered when translating.

There may be other approaches but it may be as simple as moving those text strings to the actual function that needs them, which should be late enough in the loading process to fix the problem. We do use the avatar ratings (G, PG, etc) in other places, so those need to stay but the actual text strings are only used in a single location.

Steps to Reproduce

  1. Select a site language other than English (es_ES for instance). Ensure proper language packs get installed
  2. Go to your profile page and note the Avatar Rating text is translated
  3. Turn site language back to english
  4. Set user language to a different language (es_ES again)
  5. Note the Avatar Rating text is not translated

Expected behavior
All text should be translated if a different language is chosen and translations are available

Add simple shortcode to upload image avatar any page

Is your enhancement related to a problem? Please describe.

There is only one plugin in the wordpress repository that makes a shortcode available for uploading the avatar and does it in a very polluted way. It would be great to have this implemented in your plugin which is minimalist.

Describe the solution you'd like

An elegant solution, with no filament and pollution, the user just places the shortcode [upload_avatar msg = "upload my avatar"] wherever he wants, and an upload my avatar button appears, clicking on it, opens a pop-up to upload the image and to save.

Designs

Describe alternatives you've considered

Additional context

Ability to set default avatar

Is your enhancement related to a problem? Please describe.
Noting the following received via 10up.com:

One feature i would love too see added / while not taking away from the light weight nature is…
An option to set the Default image used if someone has not yet uploaded an image.

Currently it defaults to options from Gravatar but it would be really nice if we could set a custom default image :)

Describe the solution you'd like
We'll want to consider the following:

  • is this sort of feature worthwhile in this otherwise simple, lightweight plugin?
  • should this be a per-site option, enabled network-wide, or handled some other way?

Designs

Describe alternatives you've considered

Additional context

Remove thumbnail image when "Delete local avatar" chosen

Is your enhancement related to a problem? Please describe.
Once an avatar is loaded, if I wish to remove the avatar, I don't receive any notification that removing it (clicking "Delete local avatar") worked. It does remove it, but the thumbnail doesn't disappear on click, and the Update Profile button remains disabled.

Describe the solution you'd like
Remove thumbnail of previous Avatar once "Delete local avatar" has been clicked.

Designs

Describe alternatives you've considered

Additional context
https://share.getcloudapp.com/Blu5BJ50

HTTP_REFERER is null and causing php warning

Describe the bug

PHP Warning: Undefined array key "HTTP_REFERER" in wp-content/plugins/simple-local-avatars/includes/class-simple-local-avatars.php on line 83

Version 2.3.0

Steps to Reproduce

$_SERVER['HTTP_REFERER'] is not set and cause php warning getting WordPress log full of such warnings:
PHP Warning: Undefined array key "HTTP_REFERER" in wp-content/plugins/simple-local-avatars/includes/class-simple-local-avatars.php on line 83

Screenshots, screen recording, code snippet

No response

Environment information

No response

WordPress information

version: 5.9.3

Code of Conduct

  • I agree to follow this project's Code of Conduct

Release version 2.2.0

This issue is for tracking changes for the 2.2.0 release. Target release date: TBD July 2020.

Pre-release steps

  • Review, iterate, and merge #40 (or punt to 2.3.0)
  • Review, iterate, and merge #48 (or punt to 2.3.0)
    - [ ] Agree on approach for #31, submit PR, review, iterate, and merge PR (or punt to 2.3.0) punted to next release
    - [ ] Agree on approach for #26, submit PR, review, iterate, and merge PR (or punt to 2.3.0) punted to next release
  • Add test coverage to feature/tests branch for #1, submit PR, review, iterate and merge PR (or punt to 2.3.0)
  • IDEAL: add/update screenshot files and references in readme.txt/README.md for new/updated functionality

Release steps

  • Branch: Starting from develop, cut a release branch named release/2.2.0 for your changes.
  • Version bump: Bump the version number in simple-local-avatars.php and readme.txt if it does not already reflect the version being released.
  • Changelog: Add/update the changelog in CHANGELOG.md and readme.txt.
  • Props: update CREDITS.md with any new contributors, confirm maintainers are accurate.
  • New files: Check to be sure any new files/paths that are unnecessary in the production version are included in .gitattributes.
  • Readme updates: Make any other readme changes as necessary. README.md is geared toward GitHub and readme.txt contains WordPress.org-specific content. The two are slightly different.
  • Merge: Make a non-fast-forward merge from your release branch to develop (or merge the pull request), then do the same for develop into trunk (git checkout trunk && git merge --no-ff develop). trunk contains the latest stable release.
  • Test: Run through common tasks while on trunk to be sure it functions correctly.
  • Push: Push your trunk branch to GitHub (e.g. git push origin trunk).
  • Release: Create a new release, naming the tag and the release with the new version number, and targeting the trunk branch. Paste the changelog from CHANGELOG.md into the body of the release and include a link to the closed issues on the milestone.
  • SVN: Wait for the GitHub Action to finish deploying to the WordPress.org repository. If all goes well, users with SVN commit access for that plugin will receive an emailed diff of changes.
  • Check WordPress.org: Ensure that the changes are live on https://wordpress.org/plugins/simple-local-avatars/. This may take a few minutes.
  • Close the milestone: Edit the milestone with release date (in the Due date (optional) field) and link to GitHub release (in the Description field), then close the milestone.
  • Punt incomplete items: If any open issues or PRs which were milestoned for 2.2.0 do not make it into the release, update their milestone to 2.3.0, or Future Release.

Test against WP 5.3

Is your enhancement related to a problem? Please describe.
Now that WordPress 5.3 is released, we'll want to test Simple Local Avatars to see if any incompatibility issues arise.

Describe the solution you'd like

  • test Simple Local Avatars on WP 5.3
  • open issues for any incompatibilities noted in testing
  • resolve issues identified in testing
  • bump "tested up to" version
  • if code changes needed due to incompatibilities, ship a plugin release, otherwise use "Plugin asset/readme update" action to update "tested up to" version on .org repo

Designs
n/a

Describe alternatives you've considered
none

Additional context
none

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.