Restrict Content Pro
rcp_user_has_expired_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 customer has at least one membership record with status expired. This is not the same as the deprecated rcp_is_expired() legacy member check: a user can have both an active membership and an older expired one, and this function still returns true.
Parameters
$user_id (int) – User ID to check. Default: 0 (current logged-in user).
Return values
(bool) – true if the customer has one or more memberships with status expired; false if there is no customer or no expired membership records.
Examples
if ( rcp_user_has_expired_membership( $user_id ) ) {
// Customer has at least one expired membership on file.
}
To test a specific membership ID, load it with rcp_get_membership() and use $membership->is_expired().