Yet another question about making BP Private.
-
Okay, I’ve got a question.
I’ve read pretty much every post and page on the internet pertaining to making Buddypress private. I’ve tried a bunch of things, and I’ve even had some success.
What I’m trying to accomplish is to make every single aspect of a Buddypress install private, while keeping the WP Pages & Posts open to guests and visitors.
Code:/**** Private Community****/function bp_guest_redirect() {
global $bp;
if ( bp_is_profile_component() || bp_is_activity_component() || bp_is_blogs_component() || bp_is_messages_component() || bp_is_friends_component() || bp_is_groups_component() || bp_is_settings_component() || bp_is_member() || bp_is_directory() ) { // enter the slug or component conditional here
if (!is_user_logged_in() ){ // not logged in user
bp_core_redirect( $bp->root_domain .’/please-log-in’); // user will be redirect to any link to want
}
}
}add_filter(‘get_header’,'bp_guest_redirect’,1);
This code is supposed to redirect a user to my “/please-log-in” page whenever a guest tries to access any part of the Buddypress section of the site. It does work on almost every part of Buddypress… except the Members Directory. I need to know what I need to add to my if statement so the redirect works for the Member’s directory as well. Thanks in advance.
If you’d like to see the site and the redirect in action, please visit: http://mfcommunity.org
Thanks for you help.
You must be logged in to reply to this topic.