Redirect Users to their own blog/website after login?

So, this question has been asked and answered before, but the completed answer was never left in public view, so I'm having to ask it again. Here's what I found before...

https://premium.wpmudev.org/forums/topic/redirect-user-to-their-primary-site-dashboard-after-login-on-the-main-site#post-1197407

This is exactly what I want to do on my own project. There was this bit of code left by a poster which almost does the trick:

function my_login_redirect( $redirect_to, $request, $user ) {
	//is there a user to check?
	global $user;

	if ( $user ) {
		$user_id = $user->ID;
	}

	if ( isset( $user_id ) ) {

		// Get the blogs of this user
		$user_blogs = get_blogs_of_user( $user_id );

		// Get the URL of the blog
		foreach ( $user_blogs AS $user_blog ) {

			if ( !isset( $userblogid ) ) {
				$userblogid = $user_blog->userblog_id;
				return $user_blog->domain;
			}

		}

	// If user has no blog, return to the homepage.
	} else {

		return home_url();

	}
}
add_filter( "login_redirect", "my_login_redirect", 10, 3 );

This almost works, the one problem with it being that it adds the user_blog domain after the normal site domain. So it's something like this...

http://www.mysite.com/subdom.mysite.com

when it should just be...

subdom.mysite.com

Any idea where the issue is with the code above?

Also, as an extension, if this could be amended to only work for subscriber roles, that would be killer.