function og_subgroups_propogate_user_removal in Subgroups for Organic groups 5
Same name and namespace in other branches
- 5.4 og_subgroups.module \og_subgroups_propogate_user_removal()
1 call to og_subgroups_propogate_user_removal()
- og_subgroups_og in ./
og_subgroups.module - Implementation of hook_og().
File
- ./
og_subgroups.module, line 615 - Maintains subgroups hierarchy created by the orgainc groups module.
Code
function og_subgroups_propogate_user_removal($gid, $uid) {
$demote = variable_get('og_subgroups_propagate_demote', array());
if ($demote['unsubscribe']) {
$tree = _og_subgroups_propogate_user_get_tree($gid);
$user = user_load(array(
'uid' => $uid,
));
foreach ($tree as $gid => $foo) {
// Check user isn't the manager of the group.
$sql = "SELECT uid FROM {node} WHERE nid = %d";
$manager_uid = db_fetch_object(db_query($sql, $gid));
if ($uid != $manager_uid->uid) {
og_delete_subscription($gid, $uid, array(
'og_subgroups' => TRUE,
));
}
}
}
}