#216668
 Radu
Moderator

Hi,

There was a snippet code on the forum that will lock non-paying members into levels page until they buy but i cannot found under search in forum, you can try to search for it using this keyworks, lock member , memberships.

PS: found it

COPY CODE


add_action( 'template_redirect', 'my_membersip_restrict' );
 
function my_membersip_restrict() {
    global $pmpro_pages, $post;
 
    if ( is_user_logged_in() && !pmpro_hasMembershipLevel() ) {
        if (isset($post->ID) && !in_array($post->ID, $pmpro_pages)) {
            wp_redirect( pmpro_url() );
        }
    }
}

Cheers
R

Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution

Log in with your credentials

Forgot your details?