aboutsummaryrefslogtreecommitdiff
path: root/mod/subgroups/deactivate.php
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2014-03-16 21:01:42 -0300
committerSilvio Rhatto <rhatto@riseup.net>2014-03-16 21:01:42 -0300
commit815bb3bf5a5e8da9a7962a4a532c3129f09d5735 (patch)
tree41bec5b730cc3dca936438f9e97810e7ab3ede0a /mod/subgroups/deactivate.php
parentc102a5c9f4e9e2f78260019ccab6098435b1df19 (diff)
parent5f6dc365a8445a48156b45912827eac39fd64fc5 (diff)
downloadelgg-815bb3bf5a5e8da9a7962a4a532c3129f09d5735.tar.gz
elgg-815bb3bf5a5e8da9a7962a4a532c3129f09d5735.tar.bz2
Merge commit '5f6dc365a8445a48156b45912827eac39fd64fc5' as 'mod/subgroups'
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);
+ }
+}