diff options
author | Meitar Moscovitz <meitarm@gmail.com> | 2009-02-12 02:27:13 +1100 |
---|---|---|
committer | Meitar Moscovitz <meitarm@gmail.com> | 2009-02-12 02:27:13 +1100 |
commit | 2fb8c58c84ef02766364e605d28ecaf90c5fc25f (patch) | |
tree | fb72cc6b535478800bbf9e8432cd047f6be6d788 /actions/avatarsettings.php | |
parent | b240a1719485b15c4a6497b6053c24e8a40a4e3c (diff) | |
parent | 27e23f2dd3e071712dc9d4765beaa33b57150fe0 (diff) |
Merge branch 'dev-0.7.x' into link-rel-paginate
Diffstat (limited to 'actions/avatarsettings.php')
-rw-r--r-- | actions/avatarsettings.php | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/actions/avatarsettings.php b/actions/avatarsettings.php index 7dd53f6eb..f38a44a24 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 |