rcp_is_active()

rcp_is_active($user_id = null)

This function will check whether the user ID supplied to the function is currently active, meaning they have a paid subscription that is not expired, cancelled, or pending.

Parameters:

  • $user_id - ID of the user to check (optional).

If no user ID is supplied, then the function will check the ID of the currently logged-in user.

Return values:

  • true if the user has an active, paid subscription.
  • false if the user has no subscription at all, has a free subscription, or has an expired/cancelled/pending subscription.

Example usage:

if(rcp_is_active(34)) {
	// user ID 34 has an active subscription
} else {
	// user ID 34 does not have an active subscription
}