Re: Securing components from non logged in users
This works great for me.. Redirects people who click on yoursite.com/groups/…. to my signup.php (change where you want to go) the directory for the groups will show
but strangely its is different for the members urls.. even the members directory redirects to my signup.php
1) can the members directory be visible but not anything after that?? like the groups.
2) can any one surgest a nice else or other statment that gives a message on the actual page saying something like you have to login or sign up to do this.
<?php
function oci_restrict_access(){
global $bp, $bp_unfiltered_uri;
if (!is_user_logged_in() &&
(BP_MEMBERS_SLUG == $bp_unfiltered_uri[0] && !empty( $bp->current_action ) ||
BP_GROUPS_SLUG == $bp->current_component && !empty( $bp->current_action ))){
bp_core_redirect(get_bloginfo(‘siteurl’) . ‘/signup.php’);
//bp_core_redirect(get_bloginfo(‘siteurl’) . ‘/wp-login.php?redirect_to=’ . urlencode( $bp->root_domain ));
}
}
add_action( ‘wp’, ‘oci_restrict_access’, 3 );
?>