Skip to:
Content
Pages
Categories
Search
Top
Bottom

Reply To: non-logged in users access to private pages

@profc

Participant

dear @bphelp

I try to explain better: I need 3 pages available to all users. Those three pages are: home, radio-109, contatti (these are the short name of the pages).

I want to stop users from accessing bp pages like members and groups pages by hot links.

‘registrati’ is the slug that stands for ‘register’ page on bp.

I used private_community_for_bp-master, as you suggested me, and I edited private-community-for-bp.php in this way:

/* Prevent logged out users from accessing bp pages */
function bphelp_private_community(){
global $bp_unfiltered_uri;

$bphelp_my_unblocked_pages = ‘ ‘; // Replace ‘test’ with the name of the page you would like to make available to logged out visitors EX: ‘activity’

$bphelp_my_unblocked_pages = ‘radio-109’; // Replace ‘test’ with the name of the page you would like to make available to logged out visitors EX: ‘activity’

$bphelp_my_unblocked_pages = ‘contatti’; // Replace ‘test’ with the name of the page you would like to make available to logged out visitors EX: ‘activity’

$bphelp_my_unblocked_pages = ‘registrazione’; // Replace ‘test’ with the name of the page you would like to make available to logged out visitors EX: ‘activity’

$bphelp_if_I_changed_my_register_slug_it_is = ‘registrazione’; // Replace ‘register’ if you have changed the ‘register’ slug for example to ‘sign-up’

if ( !is_user_logged_in() && !bp_is_register_page() && !bp_is_activation_page() && ( $bp_unfiltered_uri[0] != $bphelp_my_unblocked_pages ) )
bp_core_redirect( get_option(‘home’) . ‘/’ . $bphelp_if_I_changed_my_register_slug_it_is );

}
add_action( ‘wp’, ‘bphelp_private_community’, 3 );
/* End Prevent logged out users from accessing bp pages */

I want that generic users can reach those pages, but at this time they are redirect to the ‘registrazione’ page. Where I wrong? What’s the name of homepage? Is it home, even if it doesn’t appear to the link?

Thanks for your help!

Skip to toolbar