Note: This is part of the developer docs and is considered custom code.
Unfortunately, we cannot provide support for custom code at this time as we do not have the additional resources that would be necessary to provide support for custom code.
If you need assistance with this, please reach out to our list of consultants for further assistance:
https://codeable.io/developers/restrict-content-pro/
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, canceled, 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/canceled/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 }