aboutsummaryrefslogtreecommitdiff
path: root/mod/groups/actions
diff options
context:
space:
mode:
authorSem <sembrestels@riseup.net>2012-07-08 19:31:39 +0200
committerSteve Clay <steve@mrclay.org>2012-11-19 08:01:01 -0500
commit8183d5bbc2c18b6825da8ebfc15581231e23de04 (patch)
tree103ba017a78bad5df11e9d88b29291677be4746c /mod/groups/actions
parentd857c68fd91b1bcf586a30d86108b1898c2bb2d3 (diff)
downloadelgg-8183d5bbc2c18b6825da8ebfc15581231e23de04.tar.gz
elgg-8183d5bbc2c18b6825da8ebfc15581231e23de04.tar.bz2
Fixes #1854. Group owners can delegate the ownership to another group member.
Diffstat (limited to 'mod/groups/actions')
-rw-r--r--mod/groups/actions/groups/edit.php33
1 files changed, 33 insertions, 0 deletions
diff --git a/mod/groups/actions/groups/edit.php b/mod/groups/actions/groups/edit.php
index 2d7e1f023..fa96345e0 100644
--- a/mod/groups/actions/groups/edit.php
+++ b/mod/groups/actions/groups/edit.php
@@ -92,6 +92,18 @@ if ($new_group_flag) {
$group->access_id = ACCESS_PUBLIC;
}
+$owner_guid = (int) get_input('owner_guid');
+$loggedin_guid = elgg_get_logged_in_user_guid();
+$is_admin = elgg_is_admin_logged_in();
+
+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;
+ $owner_changed_flag = true;
+ }
+}
+
$group->save();
// Invisible group support
@@ -167,6 +179,27 @@ if ((isset($_FILES['icon'])) && (substr_count($_FILES['icon']['type'],'image/'))
$group->icontime = time();
}
+
+ if ($owner_changed_flag) {
+ // @todo remove other user's pictures
+ }
+
+} elseif ($owner_changed_flag) {
+
+ $filehandler = new ElggFile();
+ $filehandler->setFilename('groups');
+
+ $filehandler->owner_guid = $old_owner_guid;
+ $old_path = $filehandler->getFilenameOnFilestore();
+
+ $filehandler->owner_guid = $group->owner_guid;
+ $new_path = $filehandler->getFilenameOnFilestore();
+
+ $sizes = array('', 'tiny', 'small', 'medium', 'large');
+
+ foreach($sizes as $size) {
+ rename("$old_path/{$group_guid}{$size}.jpg", "$new_path/{$group_guid}{$size}.jpg");
+ }
}
system_message(elgg_echo("groups:saved"));