function flag_get_flag_counts in Flag 6.2
Same name and namespace in other branches
- 7.3 flag.module \flag_get_flag_counts()
- 7.2 flag.module \flag_get_flag_counts()
Get the total count of items flagged within a flag.
Parameters
$flag_name: The flag name for which to retrieve a flag count.
$reset: Reset the internal cache and execute the SQL query another time.
File
- ./
flag.module, line 1246 - The Flag module.
Code
function flag_get_flag_counts($flag_name, $reset = FALSE) {
static $counts;
if ($reset) {
$counts = array();
}
if (!isset($counts[$flag_name])) {
$flag = flag_get_flag($flag_name);
$counts[$flag_name] = db_result(db_query("SELECT COUNT(*) FROM {flag_content} WHERE fid = %d", $flag->fid));
}
return $counts[$flag_name];
}