Page visible for specific plan

Home Forums WordPress Theme CityBook – Directory & Listing WordPress Theme Page visible for specific plan

This topic contains 6 replies, has 3 voices, and was last updated by  CTHthemes 3 months, 1 week ago.

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #32409

    Aron Verhoeven
    Participant

    Support Expired

    Hi Support,

    Is it possible to hide an page for several plans?

    I would like to create an page for just 1 specific plan, which is unvisible for other plans.

    Would be nice.

    Thanks in advance.

    Aron Verhoeven

    #32429

    CTHthemes
    Keymaster

    Try this:

    
    add_filter( 'post_password_required', function($required, $post){
        // check if is your specific page id
        if($post->ID == 100){ // change 100 with your page id
            if(is_user_logged_in() == false){
                // hide page for not logged in users
                return true; // 
            }else{
                $user_plan = get_user_meta( get_current_user_id(), ESB_META_PREFIX.'member_plan', true );
                if($user_plan == 1000){ // change 1000 with plan id allowed for the page id
                    return false;
                }
    
            }
            return true;
        }
    
        return $required;
    
    }, 10, 2 );
    
    #32441

    Aron Verhoeven
    Participant

    Support Expired

    Okay, thanks! Where should I add this? On that specific page? 🙂

    #32481

    CTHthemes
    Keymaster

    You can add the code to child theme’s functions.php file.

    #32501

    at4to
    Participant

    Supported

    Hi,
    Facing the same problem, I made a specific plan page with password and send it to the specific users.

    #32511

    Aron Verhoeven
    Participant

    Support Expired

    Okay, thanks both. Will try this out and will share my experience over here.

    #32538

    CTHthemes
    Keymaster

    Hello at4to, your solution work fine but it will take time if you want to share page to many authors.

Viewing 7 posts - 1 through 7 (of 7 total)

You must be logged in to reply to this topic.

New featues: CityBook - Listing & Directory WordPress Theme version 2.1.8 was outUpdate now
+