mycred_count_ref_id_instances

Codex / mycred/log / Functions / mycred_count_ref_id_instances

Navigation:

  1. Description
  2. Usage
  3. Parameters
  4. Return

Description

This function counts the total number of occurrences a given reference combined with a ref id is used in the log either overall or for a specific user.

Requires myCRED 1.5.3 or higher.

 

Usage

if ( mycred_count_ref_id_instances( $reference, $ref_id, $user_id ) > 0 ) {
	// this user has a log entry with the given reference and ref id
}

 

Parameters

  • reference (string) required
    The reference to search for. Note this is case sensitive.
  • ref_id (int) required
    The reference id (ref_id) to include in the search. Remember that reference id’s are always integers.
  • user_id (int)
    Optional user id to include in the search. Defaults to not used.

 

Return

This function returns the number of times the reference is used in the log. Zero if no records are found or if the reference and ref_id are not provided.

Last edited March 5, 2016