Allow a user to change and remove his profile picture from user settings.

This commit is contained in:
Jan Böhmer 2023-01-25 00:10:17 +01:00
parent 04b99cd247
commit 0063d360ce
4 changed files with 60 additions and 1 deletions

View file

@ -245,6 +245,16 @@ class UserSettingsController extends AbstractController
//$em->flush();
//For some reason the avatar is not set as master picture attachment, so we do it again here
$user->setMasterPictureAttachment($attachment);
$page_need_reload = true;
}
if ($form->getClickedButton() && 'remove_avatar' === $form->getClickedButton()->getName()) {
//Remove the avatar attachment from the user if requested
if ($user->getMasterPictureAttachment() !== null) {
$em->remove($user->getMasterPictureAttachment());
$user->setMasterPictureAttachment(null);
$page_need_reload = true;
}
}
$em->flush();