[Resolved] Locking a website using bp-custom
-
Hello,
I am trying to improve this code found here (credits to David Carson I guess):
<?php
// **** Privacy ********
function restrict_access(){
global $bp, $bp_unfiltered_uri;
// If user is not logged in and
if (!is_user_logged_in() &&
(
// The current page is not register or activation
!bp_is_register_page() &&
!bp_is_activation_page()
)) {
// Redirect to registration page. Change /join to your register page slug
bp_core_redirect( get_option(‘home’) . ‘/register’ );
}
}
add_action( ‘wp’, ‘restrict_access’, 3 );
?>It does the job great but what I’m trying to do is to make 2-3 more pages available for unregistered user. So next to
!bp_is_register_page() && !bp_is_activation_page()
need to add few more pages to exclude. I’ve been struggling to find a way but fail every time. I’m guessing is simple but my php skills are close to none and I just can’t figure it out.I guess the simplest way would be to exclude specific page slugs or IDs but, how to add them there. Specifying with get_site_url() or get_page() the script is not working (unless I’m doing something wrong). (I don’t want to use a membership plugin because I have dozen of plugins already and…)
Any help appreciated!
- The topic ‘[Resolved] Locking a website using bp-custom’ is closed to new replies.