Skip to:
Content
Pages
Categories
Search
Top
Bottom

[Solved] home page url defaulting to member page, how to change to activity page


  • ngoegan
    Participant

    @ngoegan

    I’m running WP 4.7, BP 2.7.4, site url is http://www.charlottemasoneducation.org
    I have Twenty Twelve activated

    I have a static home page set as the “Register” page (because the site is private). Once people register, I am using the BP Login Redirect plugin to redirect them to the “Activity” page.

    The problem exists when I click on the header to go to the homepage, or type in http://www.charlottemasoneducation.org *after* being logged in, it takes you to the “Member” page. I want it to go to the Activity page at that point. But I can’t set the home page to the Activity page because it has to remain the Register page.

    Please help!

Viewing 16 replies - 1 through 16 (of 16 total)

  • ngoegan
    Participant

    @ngoegan

    Oops, forgot to check off “Notify me of follow-up replies via email.” Doing so now.


    ngoegan
    Participant

    @ngoegan

    Anyone?


    Shashi Kumar
    Participant

    @mastershas

    @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' );

    ngoegan
    Participant

    @ngoegan

    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?


    ngoegan
    Participant

    @ngoegan

    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.


    Shashi Kumar
    Participant

    @mastershas

    @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


    ngoegan
    Participant

    @ngoegan

    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

    ngoegan
    Participant

    @ngoegan

    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

    Shashi Kumar
    Participant

    @mastershas

    @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.


    ngoegan
    Participant

    @ngoegan

    That worked! But now when I try to go to another page – “About CM” it redirects me to the Activity page 🙁


    ngoegan
    Participant

    @ngoegan

    In fact, every buddypress component on the nav bar is now redirecting to Site-wide Activity 🙁


    ngoegan
    Participant

    @ngoegan

    This includes: Forum, Groups, Members, etc.
    The only thing excluded from redirecting is the Events tab, which is a separate plugin unrelated to BuddyPress.


    ngoegan
    Participant

    @ngoegan

    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!


    Shashi Kumar
    Participant

    @mastershas

    @ngoegan I am glad you solved it by yourself.


    ngoegan
    Participant

    @ngoegan

    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?


    Shashi Kumar
    Participant

    @mastershas

    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 🙂

Viewing 16 replies - 1 through 16 (of 16 total)
  • You must be logged in to reply to this topic.
Skip to toolbar