Created
May 6, 2013 22:11
-
-
Save shaynesanderson-zz/5528654 to your computer and use it in GitHub Desktop.
Lock BuddyPress to only logged in users
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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') . '/join' ); | |
} | |
} | |
add_action( 'wp', 'restrict_access', 3 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment