In my buddypress I have set the register page as homepage. Now whenever a logged-in user tries to access the register page(homepage), they are redirected to Members directory. I want it to change to, home page. is there any way? I have tried changing the buddypress/bp-members/bp-members-signup.php file this way:
// If the user is logged in, redirect away from here
if ( is_user_logged_in() ) {
if ( bp_is_component_front_page( 'register' ) )
$redirect_to = bp_get_root_domain() . '/' . bp_get_members_root_slug();
else
$redirect_to = bp_get_root_domain();
bp_core_redirect( apply_filters( 'bp_loggedin_register_page_redirect_to', $redirect_to ) );
return;
}
To this:
// If the user is logged in, redirect away from here
if ( is_user_logged_in() ) {
if ( bp_is_component_front_page( 'register' ) )
$redirect_to = bp_get_root_domain() . '/';
else
$redirect_to = bp_get_root_domain();
bp_core_redirect( apply_filters( 'bp_loggedin_register_page_redirect_to', $redirect_to ) );
return;
}
I am getting this error:
The page isn’t redirecting properly
Firefox has detected that the server is redirecting the request for this address in a way that will never complete.
Anyone knows how to fix this?
Just a heads-up that you should be using the
bp_loggedin_register_page_redirect_to
filter to accomplish this, rather than modifying BuddyPress files (which will get overwritten on every upgrade).Put this in your theme’s functions.php or your bp-custom.php file http://codex.buddypress.org/extending-buddypress/bp-custom-php/. It’ll accomplish the same thing, but without touching BuddyPress itself.
Couldn’t you use something like the walled garden technique. I’m not sure if it’s quite what you want, but it is customisable:
This hides members and activity from those not logged in but enables forums and groups for everyone รขยย see variation here. This goes in the buddypress bp-custom.php file and is discussed further here
Somebody put a similar snippet here
Ok. Found the issue. I was trying to redirect logged-in members from register page to homepage. And the homepage was set to register page. So, when a registered member tries to access the register page they are redirected back to homepage, which is set to the register page. So, there is a infinite loop of redirection. The browsers don’t allow this kind of redirection. So, I was getting this message:
So. instead of this:
I used this:
now it works fine. ๐ Problem solved.
Work for me ๐