function shoutbox_group_nodeapi in Shoutbox 6.2
Implementation of hook_nodeapi()
If a group is deleted, group shouts and references must be purged!
File
- shoutbox_group/
shoutbox_group.module, line 312
Code
function shoutbox_group_nodeapi(&$node, $op, $a3 = NULL, $a4 = NULL) {
switch ($op) {
case 'delete':
// If the node acts as a group
if (og_is_group_type($node->type)) {
// Gather shout ID's
$shouts = db_query("SELECT shout_id FROM {shoutbox_groups} WHERE nid = %d", $node->nid);
// Delete all of the shouts
while ($shout = db_fetch_object($shouts)) {
// Hook thrown in shoutbox_delete_shout() will delete group reference as well
shoutbox_delete_shout($shout->shout_id);
}
}
break;
}
}