function active_tags_popular_callback in Active Tags 6
Same name and namespace in other branches
- 6.2 active_tags_popular.module \active_tags_popular_callback()
Gets popular terms from the database for AJAX callback.
Parameters
$vid: Vocabulary id.
1 string reference to 'active_tags_popular_callback'
- active_tags_popular_menu in ./
active_tags_popular.module - Implementation of hook_menu().
File
- ./
active_tags_popular.module, line 55 - Adds popular terms to Active Tags widget
Code
function active_tags_popular_callback($vid) {
$matches = array();
$result = db_query_range(db_rewrite_sql("SELECT t.tid, t.name, COUNT(tn.tid) AS term_count FROM {term_data} t INNER JOIN {term_node} tn ON t.tid = tn.tid INNER JOIN {node} n ON tn.vid = n.vid WHERE t.vid = %d GROUP BY t.tid, t.name ORDER BY term_count DESC", 't', 'tid'), $vid, 0, variable_get('active_tags_popular_no_' . $vid, 10));
while ($tag = db_fetch_object($result)) {
$matches[] = check_plain($tag->name);
}
drupal_json($matches);
}