You are here

function forum_taxonomy in Drupal 6

Same name and namespace in other branches
  1. 4 modules/forum.module \forum_taxonomy()
  2. 5 modules/forum/forum.module \forum_taxonomy()

Implementation of hook_taxonomy().

File

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');
    }
  }
}