mycred_count_users_without_badge

Description

This function counts the number of users that has not earned a given badge.

This function is only available if the Badges add-on is enabled.

Available since version 1.5

Returns

(int) The number of users that has not earned the badge.

Parameters

Param Type Required Description
function mycred_count_users_without_badge(
$badge_id int Yes

The badge post object ID.

) { ... }

Examples

Example 1: Count the number of users that have not earned the badge 2 yet.

$badge_id = 2;
$count    = mycred_count_users_without_badge( $badge_id );

printf( '%d users has not yet earned this badge', $count );