function flag_rules_condition_threshold in Flag 7.2
Same name and namespace in other branches
- 6.2 includes/flag.rules.inc \flag_rules_condition_threshold()
 - 6 includes/flag.rules.inc \flag_rules_condition_threshold()
 - 7.3 flag.rules.inc \flag_rules_condition_threshold()
 
Condition: Check flagging count.
1 string reference to 'flag_rules_condition_threshold'
- flag_rules_condition_info in ./
flag.rules.inc  - Implements hook_rules_condition_info().
 
File
- ./
flag.rules.inc, line 426  - Rules integration for the Flag module.
 
Code
function flag_rules_condition_threshold($flag, $entity, $number, $operator = '=') {
  $count = $flag
    ->get_count($flag
    ->get_content_id($entity));
  switch ($operator) {
    case '>':
      return $count > $number;
    case '>=':
      return $count >= $number;
    case '=':
      return $count == $number;
    case '<':
      return $count < $number;
    case '<=':
      return $count <= $number;
  }
}