]> gitweb.fluxo.info Git - lorea/elgg.git/commitdiff
Fixes #5224 transfering container and metadata ownership
authorcash <cash.costello@gmail.com>
Tue, 12 Mar 2013 15:54:42 +0000 (11:54 -0400)
committercash <cash.costello@gmail.com>
Tue, 12 Mar 2013 15:54:42 +0000 (11:54 -0400)
mod/groups/actions/groups/edit.php

index c924ef19889ceef6e5fb66775e5a623f4db1cacb..f04ef60db7e199b9f33cab9b7c6af9f596d2e02f 100644 (file)
@@ -105,7 +105,21 @@ if (!$is_new_group && $new_owner_guid && $new_owner_guid != $old_owner_guid) {
        // verify new owner is member and old owner/admin is logged in
        if (is_group_member($group_guid, $new_owner_guid) && ($old_owner_guid == $user->guid || $user->isAdmin())) {
                $group->owner_guid = $new_owner_guid;
-               
+               $group->container_guid = $new_owner_guid;
+
+               $metadata = elgg_get_metadata(array(
+                       'guid' => $group_guid,
+                       'limit' => false,
+               ));
+               if ($metadata) {
+                       foreach ($metadata as $md) {
+                               if ($md->owner_guid == $old_owner_guid) {
+                                       $md->owner_guid = $new_owner_guid;
+                                       $md->save();
+                               }
+                       }
+               }
+
                // @todo Remove this when #4683 fixed
                $owner_has_changed = true;
                $old_icontime = $group->icontime;