function og_subgroups_nodeapi in Subgroups for Organic groups 5
Same name and namespace in other branches
- 5.4 og_subgroups.module \og_subgroups_nodeapi()
- 5.3 og_subgroups.module \og_subgroups_nodeapi()
- 6 og_subgroups.module \og_subgroups_nodeapi()
Implementation of hook_nodeapi().
File
- ./
og_subgroups.module, line 247 - Maintains subgroups hierarchy created by the orgainc groups module.
Code
function og_subgroups_nodeapi($node, $op, $teaser = NULL, $page = NULL) {
switch ($op) {
case 'load':
if (og_is_group_type($node->type)) {
$parent = og_subgroups_get_family($node->nid, 'up');
$parent[0]->gid ? $node->og_subgroups = $parent[0]->gid : NULL;
}
break;
case 'insert':
$groups = og_get_node_groups($node);
if ($groups) {
$content_directions = variable_get('og_subgroups_propagate_content', array());
og_subgroups_propogate_content($node, $groups, $content_directions);
}
break;
case 'update':
$groups = og_get_node_groups($node);
if ($groups) {
$content_directions = variable_get('og_subgroups_propagate_content', array());
og_subgroups_propogate_content($node, $groups, $content_directions);
}
break;
case 'delete':
if (og_is_group_type($node->type)) {
db_query('DELETE FROM {og_subgroups} WHERE gid = %d', $node->nid);
}
}
}