You are here

function user_badges_badge_count in User Badges 6

Same name and namespace in other branches
  1. 6.2 user_badges.rules.inc \user_badges_badge_count()

Test the user_badges_badge_count condition

File

./user_badges.rules.inc, line 170
Provide better integration into the rules module

Code

function user_badges_badge_count($account, $number, $settings) {
  $badges = user_badges_get_badges($account->uid);
  $badges_count = count($badges);
  switch ($settings['operation']) {
    case 'greater':
      return $badges_count > $number;
    case 'equal':
      return $badges_count == $number;
    case 'less':
      return $badges_count < $number;
  }
}