Conditionally redirect users to own blog based on login location

I want to redirect users to their own blog dashboard when logging in at the default wp-login.php page, but when logging in elsewhere (i.e. via a widget on bbPress forums) the default behavior should remain, which is simply refreshing the current page. This is difficult because regardless of where the login occurs, wp-login.php is executed.

The below code redirects users to their own blog after login:

// Redirect user to own website on login
function mu_login_redirect( $redirect_to, $request_redirect_to, $user )
{
if ($user->ID != 0) {
$user_info = get_userdata($user->ID);
if ($user_info->primary_blog) {
$primary_url = get_blogaddress_by_id($user_info->primary_blog) . 'wp-admin/';
if ($primary_url) {
wp_redirect($primary_url);
die();
}
}
}
return $redirect_to;
}
add_filter('login_redirect','mu_login_redirect', 100, 3);

The above snippet is in my mu-plugins folder and works fine by itself, but I’ve been unsuccessful in making it conditional upon where the login occurs (i.e. true on the default wp-login.php but false on bbPress pages and posts where login occurs via widget in the sidebar).

I’ve spent quite a few hours on this and have been unsuccessful. Some things I’ve tried:

-Making add_filter conditional depending on page.

-Using remove_filter on bbPress pages.

-Using $pagenow variable.

-Adding additional conditional statements in the function.

-And about 5 hours of other variations…

The only option I’ve heard of is adding an extra parameter to the post data which can be read from wp-login.php to say where the login occurred (suggested on the WP support forums), but I’m at a loss for how to do this.

Any ideas?