diff options
Diffstat (limited to 'mod/groups/actions')
-rw-r--r-- | mod/groups/actions/groups/edit.php | 33 |
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")); |