Restrict Content Pro
rcp_user_has_active_membership()
Coming soon: Restrict Content Pro is becoming Kadence Memberships. You may see both names used while we update the product, documentation, and customer experience.
Note: This content is provided as a resource within our developer documentation. Because custom code requires highly specific implementation, we encourage you to work with a qualified developer if you need guidance. You can find our recommended consultants here: https://codeable.io/developers/restrict-content-pro
Returns whether the user has at least one active membership (paid or free). Uses the RCP_Customer record and treats memberships with status active or cancelled as candidates, then checks each with RCP_Membership::is_active(). A cancelled membership still counts until it reaches its expiration date.
Compare with rcp_user_has_paid_membership() (paid/trial only) and the deprecated rcp_is_active() (paid/trial only).
Parameters
$user_id (int) – User ID to check. Default: 0 (current logged-in user).
Return values
(bool) – true if the customer has at least one active membership; false if there is no customer, no qualifying membership, or memberships are expired or pending.
Examples
if ( rcp_user_has_active_membership() ) {
// Logged-in user has an active membership.
}
$user_id = 12;
if ( rcp_user_has_active_membership( $user_id ) ) {
// User #12 has an active membership.
}