You are here

function og_vocab_nodeapi in OG Vocabulary 5

Same name and namespace in other branches
  1. 6 og_vocab.module \og_vocab_nodeapi()

Implementation of hook_nodeapi().

File

./og_vocab.module, line 302
Give each group its own system controlled vocabularies

Code

function og_vocab_nodeapi(&$node, $op, $teaser = NULL, $page = NULL) {
  switch ($op) {
    case 'load':
      if (og_is_group_type($node->type)) {
        $node->og_vocabularies = og_vocab_load_vocabularies($node->nid);
      }
      break;
    case 'delete':
      if (og_is_group_type($node->type)) {
        $sql = "DELETE FROM {og_vocab} WHERE nid = %d";
        db_query($sql, $node->nid);
        foreach ($node->og_vocabularies as $vocabulary) {
          taxonomy_del_vocabulary($vocabulary->vid);
        }
      }
      break;
  }
}