You are here

function forum_taxonomy in Drupal 5

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

Implementation of hook_taxonomy().

File

modules/forum/forum.module, line 147
Enable threaded discussions about general topics.

Code

function forum_taxonomy($op, $type, $term = NULL) {
  if ($op == 'delete' && $term['vid'] == _forum_get_vid()) {
    switch ($type) {
      case 'term':
        $results = db_query('SELECT f.nid FROM {forum} f WHERE f.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');
    }
  }
}