You are here

function _img_assist_term_count_nodes in Image Assist 6.2

Fetch the number of nodes for terms of given vocabulary ids.

Note that this does not count nodes of subterms, as opposed to taxonomy_term_count_nodes().

Parameters

$vids: An array of taxonomy vocabulary ids.

Return value

An array keyed by term ids with the count of nodes for each term.

Related topics

1 call to _img_assist_term_count_nodes()
img_assist_header_form in ./img_assist.module

File

./img_assist.module, line 618
Image Assist module

Code

function _img_assist_term_count_nodes($vids) {
  $count = array();
  $result = db_query(db_rewrite_sql('SELECT t.tid, COUNT(n.nid) AS count FROM {term_node} t INNER JOIN {node} n ON t.vid = n.vid INNER JOIN {term_data} td ON td.tid = t.tid WHERE n.status = 1 AND td.vid IN (' . db_placeholders($vids) . ') GROUP BY t.tid'), implode(',', $vids));
  while ($term = db_fetch_object($result)) {
    $count[$term->tid] = $term->count;
  }
  return $count;
}