Created
August 11, 2019 21:56
-
-
Save sbrajesh/ba211d5b7023a67cf638bd073c77d9d0 to your computer and use it in GitHub Desktop.
Redirect BuddyPress User to their activity instead of home page
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Redirect users to login if not not logged, otherwise, redirect to user activity. | |
*/ | |
function buddydev_custom_user_home_page() { | |
if ( ! is_user_logged_in() ) { | |
bp_core_redirect( wp_login_url( site_url( '/' ) ) ); | |
} | |
if ( is_front_page() ) { | |
bp_core_redirect( trailingslashit( bp_loggedin_user_domain() ) . bp_get_activity_slug() . '/' ); | |
} | |
} | |
add_action( 'bp_template_redirect', 'buddydev_custom_user_home_page' ); |
No Need to do that. The code takes care of that.
Hello and thanks for support, should we change (url) to my site url or leave it ?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hello and thanks for support, should we change (url) to my site url or leave it ?