Last active
February 3, 2020 12:04
-
-
Save remkus/7216882 to your computer and use it in GitHub Desktop.
BuddyPress Privacy
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 | |
add_filter( 'get_header', 'bp_guest_redirect', 1 ); | |
/** | |
* Redirect BuddyPress guests to register page | |
* @return [type] [description] | |
*/ | |
function bp_guest_redirect() { | |
global $bp; | |
if ( bp_is_activity_component() || bp_is_user_profile() || bp_is_groups_component() || bp_is_blogs_component() || bp_is_page( BP_MEMBERS_SLUG ) ) { | |
// enter the slug or component conditional here | |
if ( !is_user_logged_in() ) { // not logged in user | |
wp_redirect( get_option( 'siteurl' ) . '/registreren' ); | |
} // user will be redirect to any link to want | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment