basic-user-avatars icon indicating copy to clipboard operation
basic-user-avatars copied to clipboard

Fix deletion of old avatars before upload of new

Open efc opened this issue 1 year ago • 1 comments

The current code uses $this->user_id_being_edited as the argument to $this->avatar_delete on line 352, but it does not set this value until line 359. This means that avatar_delete is always getting a null user and never actually deleting anything.

This change uses $user_id as the argument instead, which allows the plugin to delete the old avatars before uploading the new.

Given the text in the description of what will happen on the profile page ("Replace the local avatar by uploading a new avatar"), deleting the old avatars would be the expected behavior. We want to replace the local avatar, not leave it lingering in the uploads directory. This pull request accomplishes the result promised in the description.

efc avatar Jan 29 '24 03:01 efc

check my reply here delete old image and gif not playing #69

Rise-KuN avatar Apr 12 '24 16:04 Rise-KuN