Fix handing of super admins that don't have a blog in get_dashboard_url() and login. Props nacin. fixes #17829

git-svn-id: http://svn.automattic.com/wordpress/trunk@18328 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2011-06-22 19:45:28 +00:00
parent 9096c1a3c6
commit 4fa8ee19e4
2 changed files with 3 additions and 3 deletions

View File

@ -2302,13 +2302,13 @@ function get_dashboard_url( $user_id, $path = '', $scheme = 'admin' ) {
$user_id = (int) $user_id;
$blogs = get_blogs_of_user( $user_id );
if ( empty($blogs) ) {
if ( ! is_super_admin() && 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 && in_array($current_blog, array_keys($blogs)) ) {
if ( $current_blog && ( is_super_admin( $user_id ) || in_array( $current_blog, array_keys( $blogs ) ) ) ) {
$url = admin_url( $path, $scheme );
} else {
$active = get_active_blog_for_user( $user_id );

View File

@ -586,7 +586,7 @@ default:
if ( ( empty( $redirect_to ) || $redirect_to == 'wp-admin/' || $redirect_to == admin_url() ) ) {
// If the user doesn't belong to a blog, send them to user admin. If the user can't edit posts, send them to their profile.
if ( is_multisite() && !get_active_blog_for_user($user->id) )
if ( is_multisite() && !get_active_blog_for_user($user->id) && !is_super_admin( $user->id ) )
$redirect_to = user_admin_url();
elseif ( is_multisite() && !$user->has_cap('read') )
$redirect_to = get_dashboard_url( $user->id );