This function counts the number of users that has a given badge with the option to count badge level.
(int) The number of users that has a badge or badge level.
The badge post object ID.
Option to count a specific level for the given badge.
Example 1: Count the number of users that have a badge with the id 1.
$badge_id = 1; $count = mycred_count_users_with_badge( $badge_id ); printf( '%d users have earned this badge', $count );