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

Images names should be versioned #43

Closed markRosenvinge closed 2 years ago

markRosenvinge commented 3 years ago

Hi,

There is a challenge in this plugin with browser cache or using cdn's or reverse proxies. This happens because the avatar image is saved with the same name every time and there is no cache busting applied to the render of the images.

Wordpress tries to accommodate for this by changing the location of the folder with year and month, but the problem still occurs if the images is changed within the same day.

An easy fix for this would be adding a unix timestamp to the image name when uploading a new image. This could be done in the unique_filename_callback() method.

A more smooth solution would be for grab is any existing avatars with the same name before running avatar_delete() and then incrementing the counter in unique_filename_callback() based on that aswell.

elizabeth-hereandnowdigital commented 2 years ago

I'm experiencing similar issues with the avatar images being cached. Is there a work around for this available?

andrewlimaza commented 2 years ago

There is currently a Pull Request that may fix this issue. I do not have a timeframe when this will be resolved/merged in but you may merge in this Pull Request prematurely if you need it done urgently.