mycred_display_users_total_balance

Description

Returns a given users total balance for a specific point type formatted. This means the balance will be applied the appropriate separator characters you have defined along with any prefix / suffix that might be set. If you are looking to display a user’s current balance, consider using the mycred_display_users_balance function instead.

Available since version 1.7.6

Returns

(string | bool) The users total balance formatted with prefix / suffix (if used). If the user ID is invalid or the user is excluded, this function will return FALSE.

Parameters

Param Type Required Description
function mycred_display_users_total_balance(
$user_id int Yes

The users numeric ID.

$point_type string No

The point type key. Should only be used if you require the balance of a custom point type.

) { ... }

Examples

Example 1: Get the current users total balance.

$user_id = get_current_user_id();
echo mycred_display_users_total_balance( $user_id );

Example 2: Get the BuddyPress profiles custom point type total balance.

$profile_id = bp_displayed_user_id();
echo mycred_display_users_total_balance( $profile_id, 'customtypekey' );