Returns the number of times a specific reference occurs in the log, with the option to filter by user ID or by point type.
(int) Returns the number of found records.
The reference to count.
Option to filter the count by a user ID.
Option to filter results by a particular point type.
Example 1: Count the number of times a user has received points for approved comments.
$user_id = 1; $count = mycred_count_ref_instances( 'approved_comment', $user_id );
Example 2: Count the number of times points have been spent on paying for a WooCommerce order.
$payments = mycred_count_ref_instances( 'woocommerce_payment' );