clarkwinkelmann - I don't think it's that they're doing something incompatible, I think it's just that 10 is the highest priority and only one login_redirect can run. I could not get ANY login_redirect to work while that theme was active. Here is the source for what they're doing in their theme's "login.php", though:
add_filter( 'login_redirect', 'buddyboss_redirect_previous_page', 10, 3 );
function buddyboss_redirect_previous_page( $redirect_to, $request, $user ) {
if ( buddyboss_theme()->buddypress_helper()->is_active() ) {
$bp_pages = false;
// Check if Platform plugin is active.
if( function_exists('bp_get_option') ){
$bp_pages = bp_get_option( 'bp-pages' );
}
$activate_page_id = !empty( $bp_pages ) && isset( $bp_pages[ 'activate' ] ) ? $bp_pages[ 'activate' ] : null;
if ( (int) $activate_page_id <= 0 ) {
return $redirect_to;
}
$activate_page = get_post( $activate_page_id );
if ( empty( $activate_page ) || empty( $activate_page->post_name ) ) {
return $redirect_to;
}
$activate_page_slug = $activate_page->post_name;
if ( strpos( $request, '/' . $activate_page_slug ) !== false ) {
$redirect_to = home_url();
}
}
$request = wp_get_referer();
if ( ! $request ) {
return $redirect_to;
}
// redirect for native mobile app
if ( ! is_user_logged_in() && wp_is_mobile() ) {
$path = wp_parse_url( $request );
if ( isset( $path['query'] ) && ! empty( $path['query'] ) ) {
parse_str( $path['query'], $output );
$redirect_to = ( isset( $output ) && isset( $output['redirect_to'] ) && '' !== $output['redirect_to'] ) ? $output['redirect_to'] : $redirect_to;
return $redirect_to;
}
}
$req_parts = explode( '/', $request );
$req_part = array_pop( $req_parts );
$url_arr = [];
$url_query_string = [];
if ( substr( $req_part, 0, 3 ) == 'wp-' ) {
$url_query_string = wp_parse_url( $request );
if ( isset( $url_query_string['query'] ) && ! empty( $url_query_string['query'] ) ) {
parse_str( $url_query_string['query'], $url_arr );
$redirect_to = ( isset( $url_arr ) && isset( $url_arr['redirect_to'] ) && '' !== $url_arr['redirect_to'] ) ? $url_arr['redirect_to'] : $redirect_to;
return $redirect_to;
} else {
return $redirect_to;
}
}
$request = str_replace( array( '?loggedout=true', '&loggedout=true' ), '', $request );
return $request;
}