Oops, forgot to check off “Notify me of follow-up replies via email.” Doing so now.
@ngoegan add the following code in your child theme’s function file. It modifies default behavior and redirect user to activity page. Link to the source of code
function bbg_bp_loggedin_register_page_redirect_to( $redirect_to ) {
if ( bp_is_component_front_page( 'register' ) )
$redirect_to = bp_get_root_domain() . '/activity';
return $redirect_to;
}
add_filter( 'bp_loggedin_register_page_redirect_to', 'bbg_bp_loggedin_register_page_redirect_to' );
I tried a different approach – I set the “Site-wide Activity” page as my static home page in Settings>Reading.
Now it is causing a redirect loop when a non-logged in user goes to the homepage (www.charlottemasoneducation.org)
If I set the home page in the above settings back to the “Register” page, it stops the loop.
There seems to have been a ticket about this issue here: https://buddypress.trac.wordpress.org/ticket/4706
I’m not understanding the fix mentioned above and am not certain it is the same exact issue.
How can I fix this redirect problem?
The strange thing also is that when the home page is set to “Register” it actually sends logged in users to the “Member” page, not the Register page.
@ngoegan the logic in the Buddypress is correct why an user would like to go to register page when he is already registered and logged in. According to your stated problem your can make register page as static homepage and add the above code in your child’s theme function file or bp-custom.php. It will redirect all your logged in user to activity page.
To know about how to add bp-custom file read this beautiful post
I tried and am now getting this error on the site:
/** * Add location to BP Member directory */ function my_directory() { if ( bp_is_active( 'xprofile' ) ) if ( $field_7 = xprofile_get_field_data( 'Location', bp_get_member_user_id() ) ) : echo '
'; echo $field_7; echo '
'; endif; } add_filter ( 'bp_directory_members_item', 'my_directory' ); /** * */redirect all users to homepage function bbg_bp_loggedin_register_page_redirect_to( $redirect_to ) { if ( bp_is_component_front_page( 'register' ) ) $redirect_to = bp_get_root_domain() . '/activity'; return $redirect_to; } add_filter( 'bp_loggedin_register_page_redirect_to', 'bbg_bp_loggedin_register_page_redirect_to' );
Warning: Cannot modify header information - headers already sent by (output started at /home4/cgoegan/public_html/charlottemasoneducation.org/wp-content/plugins/bp-custom.php:33) in /home4/cgoegan/public_html/charlottemasoneducation.org/wp-includes/pluggable.php on line 1216
Actually, there was something else in there, I deleted it. Here’s the error I’m getting with just your code now:
//redirect all users to homepage function bbg_bp_loggedin_register_page_redirect_to( $redirect_to ) { if ( bp_is_component_front_page( 'register' ) ) $redirect_to = bp_get_root_domain() . '/activity'; return $redirect_to; } add_filter( 'bp_loggedin_register_page_redirect_to', 'bbg_bp_loggedin_register_page_redirect_to' );
Warning: Cannot modify header information - headers already sent by (output started at /home4/cgoegan/public_html/charlottemasoneducation.org/wp-content/plugins/bp-custom.php:14) in /home4/cgoegan/public_html/charlottemasoneducation.org/wp-includes/pluggable.php on line 1216
@ngoegan I think there is something wrong with your bp-custom file. My suggestion
1. Try to place the code in your theme’s functions.php file
2. Clean up your bp-custom php all codes and put the code only and recheck. This error usually comes due to wrong placement of codes or some plugin confliction.
That worked! But now when I try to go to another page – “About CM” it redirects me to the Activity page 🙁
In fact, every buddypress component on the nav bar is now redirecting to Site-wide Activity 🙁
This includes: Forum, Groups, Members, etc.
The only thing excluded from redirecting is the Events tab, which is a separate plugin unrelated to BuddyPress.
I fixed it. The theme I was using “Evolve” added a bunch of custom code to the Register page. Even though I switched to Twenty Twelve, it left the code on the page. I deleted it and everything appears to be working properly now. Thank you for your help!
@ngoegan I am glad you solved it by yourself.
Oh no! I’m having redirect issues again 🙁
My Events Page (The Events Calendar plugin) and My Forum Page (bbpress) are both redirecting to the Activity page now. All others are fine – groups, members, etc.
I tried re-setting them in the navigation menu, I tried disabling plugins, I’m not sure why your code is causing pages other than ‘register’ to re-direct to activity?
Hi @ngoegan
Above code is working fine on my install. I am not facing a redirection issue on forum page. If you closely watch the code there is an if statement which checks if we are on register page.
You can do a few things
1. Clear your cache if using a caching plugin.
2. Clear your browser cookies and check
3. Go to settings > permalink and re save
4. Change to default theme and deactivate all plugins except bbpress and buddypress and place the code in theme’s functions.php file and check
Happy Debugging 🙂