strangerstudios / basic-user-avatars

Add an avatar upload field on frontend pages and on the Edit Profile screen so users and admins can manage custom profile pictures without Gravatar.
https://wordpress.org/plugins/basic-user-avatars/
39 stars 34 forks source link

Bug Fix: Deletes an avatar before we can check duplicates and rename #54

Closed JarrydLong closed 2 years ago

JarrydLong commented 2 years ago

Relates to Issue #43

We've been deleting the image before we can check if it exists, and then rename it to flush any cache that could be on that image.

Instead, I've added in a filter called basic_user_avatar_delete_avatar_before_upload which is set to false by default. This ensures that if you upload more than one image, we rename it and increment the number (image below)

image

If set to true, it will delete the existing image and upload a file with the exact same file name. Cleaner approach but does cause issues on sites with caching.