Skip to:
Content
Pages
Categories
Search
Top
Bottom

Reply To: two page home page?

@bphelp

Participant

@villnoweric
Try this it is a slightly modified snippet I did earlier but fits your requirement. Follow the instructions in the code.`
// PLEASE NOTE FOR THIS TO WORK:
// Before adding this code to bp-custom.php
// https://codex.buddypress.org/developer/customizing/bp-custom-php/
// you will need to create a new page in the dashboard and name it
// something like “Dummy Page” for example or any name you choose.
// Do not add this page to your menu because it is just a dummy page
// for the redirect. Then go to Dashboard/Settings/Reading.
// Under “Front page displays” select “A static page.” Then use the
// “Front page” drop-down menu to select the page you created. In my
// example for instance I selected “Dummy Page” for my front page.
// Done! Now logged out visitors get redirected to the register page,
// and logged in users get redirected to the activity stream.

/* Redirects to profile upon login, and logged out users are redirected to register page */
function bp_help_redirect_to_profile(){
if( is_user_logged_in() && bp_is_front_page() ) {
bp_core_redirect( get_option( ‘home’ ) . ‘/activity/’ );

}else {
if ( !is_user_logged_in() && !bp_is_register_page() && !bp_is_activation_page() )
bp_core_redirect( get_option( ‘home’ ) . ‘/register/’ );
}
}

add_action( ‘get_header’, ‘bp_help_redirect_to_profile’,1 );
`

Skip to toolbar