rcp_show_subscription_level

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/
This filter determines whether or not a subscription level should appear in the selection list in the  [register_form] shortcode.
Parameters:

$show (bool) – Whether or not to show the level (true or false).

$level_id (int) – ID of the level currently being tested.

$user_id (int) – ID of the user who’s visiting the registration form (0 if not logged in).

Example:
function ag_rcp_show_subscription_level( $show, $level_id, $user_id ) {
// Don’t show level #1 if the current user is on level #3.
if ( 1 == $level_id && 3 == rcp_get_subscription_id( $user_id ) ) {
$show = false;
}

return $show;
}

add_filter( ‘rcp_show_subscription_level’, ‘ag_rcp_show_subscription_level’, 10, 3 );

Have more questions?

Submit a request