X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=actions%2Favatarsettings.php;h=f38a44a24a3e782dc20b588005a6d39ac09c47b4;hb=da532bae9131b6dec8f5c0d67ce77c4ad1736f7d;hp=7dd53f6eb5af40f4e959d4a79a28f6ef5f988808;hpb=bb2cb65c2aa763c8b28c41b9811c6026a11482db;p=quix0rs-gnu-social.git diff --git a/actions/avatarsettings.php b/actions/avatarsettings.php index 7dd53f6eb5..f38a44a24a 100644 --- a/actions/avatarsettings.php +++ b/actions/avatarsettings.php @@ -145,6 +145,7 @@ class AvatarsettingsAction extends AccountSettingsAction 'height' => AVATAR_PROFILE_SIZE, 'alt' => $user->nickname)); $this->elementEnd('div'); + $this->submit('delete', _('Delete')); $this->elementEnd('li'); } @@ -256,6 +257,8 @@ class AvatarsettingsAction extends AccountSettingsAction $this->uploadAvatar(); } else if ($this->arg('crop')) { $this->cropAvatar(); + } else if ($this->arg('delete')) { + $this->deleteAvatar(); } else { $this->showForm(_('Unexpected form submission.')); } @@ -344,6 +347,29 @@ class AvatarsettingsAction extends AccountSettingsAction $this->showForm(_('Failed updating avatar.')); } } + + /** + * Get rid of the current avatar. + * + * @return void + */ + + function deleteAvatar() + { + $user = common_current_user(); + $profile = $user->getProfile(); + + $avatar = $profile->getOriginalAvatar(); + $avatar->delete(); + $avatar = $profile->getAvatar(AVATAR_PROFILE_SIZE); + $avatar->delete(); + $avatar = $profile->getAvatar(AVATAR_STREAM_SIZE); + $avatar->delete(); + $avatar = $profile->getAvatar(AVATAR_MINI_SIZE); + $avatar->delete(); + + $this->showForm(_('Avatar deleted.'), true); + } /** * Add the jCrop stylesheet