diff options
author | Dries Buytaert <dries@buytaert.net> | 2003-05-27 06:55:20 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2003-05-27 06:55:20 +0000 |
commit | c74f65a9681cffed8b43fbf83888d7f1b8f00d5b (patch) | |
tree | 88480e3c7910057acfd7529dd753b7b96c80eab9 /modules/taxonomy/taxonomy.module | |
parent | b9e8016fc1dcacc5616a775a5cb6579816e6d393 (diff) | |
download | brdo-c74f65a9681cffed8b43fbf83888d7f1b8f00d5b.tar.gz brdo-c74f65a9681cffed8b43fbf83888d7f1b8f00d5b.tar.bz2 |
- Bugfix: assure that taxonomy_term_node_counts() only takes published nodes
into account. Patch by Moshe.
Diffstat (limited to 'modules/taxonomy/taxonomy.module')
-rw-r--r-- | modules/taxonomy/taxonomy.module | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/modules/taxonomy/taxonomy.module b/modules/taxonomy/taxonomy.module index c6d9f8103..70da7475c 100644 --- a/modules/taxonomy/taxonomy.module +++ b/modules/taxonomy/taxonomy.module @@ -501,17 +501,17 @@ function taxonomy_get_synonym_root($term) { return db_fetch_object(db_query("SELECT * FROM term_synonym s, term_data t WHERE t.tid = s.tid AND s.name = '%s'", $term)); } -// given a term id, count number of nodes in it +// given a term id, count number of published nodes in it function taxonomy_term_count_nodes($tid, $type = 0) { static $count; if (!isset($count[$type])) { // $type == 0 always evaluates true is $type is a string if (is_numeric($type)) { - $result = db_query("SELECT t.tid, COUNT(*) AS c FROM term_node t GROUP BY t.tid"); + $result = db_query("SELECT t.tid, COUNT(*) AS c FROM term_node t LEFT JOIN node n ON t.nid = n.nid WHERE n.status = 1 GROUP BY t.tid"); } else { - $result = db_query("SELECT t.tid, COUNT(*) AS c FROM term_node t, node n WHERE t.nid = n.nid AND n.type = '%s' GROUP BY t.tid", $type); + $result = db_query("SELECT t.tid, COUNT(*) AS c FROM term_node t, node n WHERE t.nid = n.nid AND n.status = 1 AND n.type = '%s' GROUP BY t.tid", $type); } while ($term = db_fetch_object($result)) { $count[$type][$term->tid] = $term->c; |