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

Fix deletion of old avatars before upload of new #79

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from

Conversation

efc
Copy link

@efc efc commented Jan 29, 2024

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

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