aboutsummaryrefslogtreecommitdiff
path: root/mod/subgroups/deactivate.php
blob: 9b0cd11899db7a8dad6e035c5f710cf89c03b4fa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
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);
	}
}