I am searching for the same, just a redirect after logging in to the groups page, nothing else.
Thanks
>I’ve seen the way you can direct a user to their profile
Use the same approach and replace the profile url with the groups url.
bp_core_redirect( get_option('home') . '/groups/' );
shanebp,
I appreciate your suggestion but I’ve no idea where to begin with this. Am I supposed to add the code to bp-core, or where?
If your groups are at url/groups/
then try pasting the code below into your theme / functions.php
It should redirect non-admins to the groups page.
based on https://codex.wordpress.org/Plugin_API/Filter_Reference/login_redirect
function shug_login_redirect( $redirect_to, $request, $user ) {
//is there a user to check?
global $user;
if ( isset( $user->roles ) && is_array( $user->roles ) ) {
//check for admins
if ( in_array( 'administrator', $user->roles ) ) {
// redirect them to the default place
return $redirect_to;
} else {
return home_url('/groups/');
}
} else {
return $redirect_to;
}
}
add_filter( 'login_redirect', 'shug_login_redirect', 10, 3 );