Skip to:
Content
Pages
Categories
Search
Top
Bottom

Redirect to member home?

  • @meridioinc

    Participant

    Wordpress 4.9.8
    Latest BP install
    meridioinc.com

    After a member logs in, they are still on the login page. How do I get it to redirect to their home page for their account? Issue seems to occur(in one way or another) regardless of theme. I’m pretty sure there’s some code I can change, I’m just not sure which file to look at.

Viewing 6 replies - 1 through 6 (of 6 total)
  • @meridioinc

    Participant

    *Update*

    Now it’s redirecting to the WordPress admin page for a user account. Not the super admin for the site, but just the account. Not sure I recall editing anything for this to happen.

    @prashantvatsh

    Participant

    Please paste this code in your child theme’s functions.php file or you can use this plugin https://wordpress.org/plugins/code-snippets/ as well

    add_filter( ‘bp_login_redirect’, ‘ps_redirect_to_profile’, 11, 3 );

    function ps_redirect_to_profile( $redirect_to, $redirect_url, $user ){

    if( empty( $redirect_to) )
    $redirect_to = admin_url();

    //if the user is not site admin,redirect to his/her profile

    if( isset( $user->ID) && ! is_super_admin( $user->ID ) )
    return bp_core_get_user_domain( $user->ID );
    else
    return $redirect_to;

    }

    It will redirect site admins to dashboard and other users to their profile.

    Thanks

    @meridioinc

    Participant

    Tried that code and it didn’t work. It seemed to have no effect at all.

    @prashantvatsh

    Participant

    @meridioinc

    Participant

    Looks like it’s working. Thanks a heap.

    @prashantvatsh

    Participant

    Great 🙂

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