if ( is_multisite() && !
user_can( $user_id, 'manage_network'
) &&
empty( $blogs ) ) { $url =
user_admin_url( $path,
$scheme );
} elseif ( !
is_multisite() ) { $url =
admin_url( $path,
$scheme );
} else { $current_blog =
get_current_blog_id();
if ( $current_blog && ( user_can( $user_id, 'manage_network'
) ||
in_array( $current_blog,
array_keys( $blogs ), true
) ) ) { $url =
admin_url( $path,
$scheme );
} else { $active =
get_active_blog_for_user( $user_id );
if ( $active ) { $url =
get_admin_url( $active->blog_id,
$path,
$scheme );
} else { $url =
user_admin_url( $path,
$scheme );
} } } /**
* Filters the dashboard URL for a user.
*
* @since 3.1.0
*
* @param string $url The complete URL including scheme and path.
* @param int $user_id The user ID.
* @param string $path Path relative to the URL. Blank string if no path is specified.
* @param string $scheme Scheme to give the URL context. Accepts 'http', 'https', 'login',
* 'login_post', 'admin', 'relative' or null.
*/