mycred_query_users_total

Description

This function will query the myCRED log in order to get a given users total balance for a particular point type.

If the given user does not have any log entries, this function will instead return their current balance.

Available since version 1.4.1

Returns

(int | float) The users total balance.

Parameters

Param Type Required Description
function mycred_query_users_total(
$user_id int Yes

The users numeric WordPress ID.

$point_type string No

The point type key indicating the point type we want to calculate a total for.

) { ... }

Examples

Example 1: Get the current users default point type total. (recommended usage when you only have one point type setup).

$user_id = get_current_user_id();
$total   = mycred_query_users_total( $user_id );