Just succeed, modifing the code you give me for the “display all achivement of a user” (wich is very powerful ??
here is my code :
// Custom BadgeOS User Achievement Count
function custom_badgeos_user_achievements_count( $args = array() ) {
// Parse our arguments
$args = wp_parse_args(
$args,
array(
'user' => get_current_user_id(),
'type' => '',
)
);
// Grab the user's current achievements, without duplicates
$achievements = array_unique( badgeos_get_user_earned_achievement_ids( $args['user'], $args['type'] ) );
// Setup a counter
$count_total = 0;
// Loop through the achievements
if ( ! empty( $achievements ) ) {
foreach( $achievements as $achievement_id ) {
$count_total++;
}
}
return $count_total;
}
<?php echo custom_badgeos_user_achievements_count ( array( 'user' => $user->ID, 'type' => 'badges' ) );?>
I will probably make a Gist for this ??