Skip to:
Content
Pages
Categories
Search
Top
Bottom

Re: How to requirie log in to access everything


chewbaker
Participant

@chewbaker

Hey, I have been having the same problem! I found a partial solution to this in a previous post, but it only makes certain specified ‘slugs’ private, and not the entire site. Is there anyway we can modify this code to make it privatize the whole site?

the code is located in bp-custom.php in the mu-plugins folder.

//this makes directories private

function oci_restrict_access(){
global $bp, $bp_unfiltered_uri;

if (!is_user_logged_in() &&
(BP_MEMBERS_SLUG == $bp_unfiltered_uri[0] ||
BP_FORUMS_SLUG == $bp->current_component ||
BP_GROUPS_SLUG == $bp->current_component ||
BP_HOME_BLOG_SLUG == $bp->current_component)){

bp_core_redirect( get_option('home') . "/wp-login.php" );
}
}
add_action( 'wp', 'oci_restrict_access', 3 );

any help would be great!

Skip to toolbar