function forum_taxonomy

6.x forum.module forum_taxonomy($op, $type, $term = NULL)

Implementation of hook_taxonomy().

File

drupal-6.x/modules/forum/forum.module, line 333
Enable threaded discussions about general topics.

Code

function forum_taxonomy($op, $type, $term = NULL) {
  if ($op == 'delete' && $term['vid'] == variable_get('forum_nav_vocabulary', '')) {
    switch ($type) {
      case 'term':
        $results = db_query('SELECT tn.nid FROM {term_node} tn WHERE tn.tid = %d', $term['tid']);
        while ($node = db_fetch_object($results)) {
          // node_delete will also remove any association with non-forum vocabularies.
          node_delete($node->nid);
        }

        // For containers, remove the tid from the forum_containers variable.
        $containers = variable_get('forum_containers', array());
        $key = array_search($term['tid'], $containers);
        if ($key !== FALSE) {
          unset($containers[$key]);
        }
        variable_set('forum_containers', $containers);
        break;
      case 'vocabulary':
        variable_del('forum_nav_vocabulary');
    }
  }
}