aboutsummaryrefslogtreecommitdiff
path: root/mod/subgroups/deactivate.php
diff options
context:
space:
mode:
Diffstat (limited to 'mod/subgroups/deactivate.php')
-rw-r--r--mod/subgroups/deactivate.php18
1 files changed, 18 insertions, 0 deletions
diff --git a/mod/subgroups/deactivate.php b/mod/subgroups/deactivate.php
new file mode 100644
index 000000000..9b0cd1189
--- /dev/null
+++ b/mod/subgroups/deactivate.php
@@ -0,0 +1,18 @@
+<?php
+/**
+ * Resets container guids from all groups that aren't subgroups to owner guid
+ */
+
+$groups = elgg_get_entities(array(
+ 'type' => 'group',
+ 'limit' => 0,
+));
+
+foreach($groups as $group) {
+ global $CONFIG;
+ if (!elgg_instanceof($group->getContainerEntity(), 'group')) {
+ $query = "UPDATE {$CONFIG->dbprefix}entities set"
+ . " container_guid=0 where guid={$group->owner_guid}";
+ update_data($query);
+ }
+}