aboutsummaryrefslogtreecommitdiff
path: root/mod/groups/actions
diff options
context:
space:
mode:
authorSem <sembrestels@riseup.net>2012-07-17 19:59:48 +0200
committerSteve Clay <steve@mrclay.org>2012-11-19 08:01:02 -0500
commit158a02f263a2d48e9832b5f403b04f3fdcf21ac4 (patch)
treee05838de9c4e661710993e0a450b0924f130d624 /mod/groups/actions
parent004c2fbbb557ba2de60c2f05853d0f892383df45 (diff)
downloadelgg-158a02f263a2d48e9832b5f403b04f3fdcf21ac4.tar.gz
elgg-158a02f263a2d48e9832b5f403b04f3fdcf21ac4.tar.bz2
Refs #1854. Removing old owner icons when changing the owner and changing the icon at the same time.
Diffstat (limited to 'mod/groups/actions')
-rw-r--r--mod/groups/actions/groups/edit.php20
1 files changed, 17 insertions, 3 deletions
diff --git a/mod/groups/actions/groups/edit.php b/mod/groups/actions/groups/edit.php
index fa96345e0..d8c7a7566 100644
--- a/mod/groups/actions/groups/edit.php
+++ b/mod/groups/actions/groups/edit.php
@@ -100,7 +100,10 @@ if (!$new_group_flag && $owner_guid && $owner_guid != $group->owner_guid) {
if($group->isMember($owner_guid) && ($group->owner_guid == $loggedin_guid || $is_admin)) {
$old_owner_guid = $group->owner_guid;
$group->owner_guid = $owner_guid;
+
+ // @todo Remove this when #4683 fixed
$owner_changed_flag = true;
+ $old_icontime = $group->icontime;
}
}
@@ -180,11 +183,22 @@ if ((isset($_FILES['icon'])) && (substr_count($_FILES['icon']['type'],'image/'))
$group->icontime = time();
}
- if ($owner_changed_flag) {
- // @todo remove other user's pictures
+ if ($owner_changed_flag && $old_icontime) { // @todo Remove this when #4683 fixed
+
+ $filehandler = new ElggFile();
+ $filehandler->setFilename('groups');
+
+ $filehandler->owner_guid = $old_owner_guid;
+ $old_path = $filehandler->getFilenameOnFilestore();
+
+ $sizes = array('', 'tiny', 'small', 'medium', 'large');
+
+ foreach($sizes as $size) {
+ unlink("$old_path/{$group_guid}{$size}.jpg");
+ }
}
-} elseif ($owner_changed_flag) {
+} elseif ($owner_changed_flag && $old_icontime) { // @todo Remove this when #4683 fixed
$filehandler = new ElggFile();
$filehandler->setFilename('groups');