summaryrefslogtreecommitdiff
path: root/actions/avatarsettings.php
diff options
context:
space:
mode:
authorEvan Prodromou <evan@controlyourself.ca>2009-02-11 10:11:26 -0500
committerEvan Prodromou <evan@controlyourself.ca>2009-02-11 10:11:26 -0500
commit27e23f2dd3e071712dc9d4765beaa33b57150fe0 (patch)
tree36da33f7e7421072de192588bd4ac606522fdfb5 /actions/avatarsettings.php
parent26b0bc3aab831c26058274554580e3beb68b1113 (diff)
parent646fdea1bf8a93bbfb60212982a218994ffa8bbe (diff)
Merge branch 'sgmurphy-clone/0.7.x' into 0.7.x
Diffstat (limited to 'actions/avatarsettings.php')
-rw-r--r--actions/avatarsettings.php26
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