function og_subgroups_save_family in Subgroups for Organic groups 5.3
1 call to og_subgroups_save_family()
File
- ./
og_subgroups.module, line 735 - Maintains a hierarchy of group/subgroup relationships.
Code
function og_subgroups_save_family($this_node, $family_type) {
$tree = og_subgroups_get_family($this_node, $family_type);
if ($tree) {
$sql = "DELETE FROM {og_ancestry} WHERE nid = %d";
db_query($sql, $this_node->nid);
foreach ($tree as $this_tree) {
$this_tree_node = node_load($this_tree['nid']);
if (!og_is_omitted_type($this_tree_node->type)) {
$sql = "INSERT INTO {og_ancestry} (nid, group_nid, is_public) VALUES (%d, %d, %d)";
$gid = $this_tree['nid'];
db_query($sql, $this_node->nid, $gid, $this_node->og_public);
}
if (!empty($this_tree[$family_type])) {
foreach ($this_tree[$family_type] as $this_key => $this_value) {
$my_member = node_load($this_key);
if (!og_is_omitted_type($my_member->type)) {
$gid = $this_key;
$sql = "INSERT INTO {og_ancestry} (nid, group_nid, is_public) VALUES (%d, %d, %d)";
db_query($sql, $this_node->nid, $gid, $this_node->og_public);
}
}
}
}
}
}