Skip to content
This repository was archived by the owner on Nov 25, 2024. It is now read-only.

Fix deletion of old avatars before upload of new#79

Open
efc wants to merge 1 commit into
strangerstudios:devfrom
efc:dev
Open

Fix deletion of old avatars before upload of new#79
efc wants to merge 1 commit into
strangerstudios:devfrom
efc:dev

Conversation

@efc

@efc efc commented Jan 29, 2024

Copy link
Copy Markdown

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.

$this->user_id_being_edited has not yet been set, so use $user_id instead
@Rise-KuN

Copy link
Copy Markdown

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants