WordPress.org

Make WordPress Core

Ticket #17829: 17829.2.diff

File 17829.2.diff, 1.5 KB (added by nacin, 3 years ago)
  • wp-login.php

     
    586586 
    587587                if ( ( empty( $redirect_to ) || $redirect_to == 'wp-admin/' || $redirect_to == admin_url() ) ) { 
    588588                        // 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. 
    589                         if ( is_multisite() && !get_active_blog_for_user($user->id) ) 
     589                        if ( is_multisite() && !get_active_blog_for_user($user->id) && !is_super_admin( $user->id ) ) 
    590590                                $redirect_to = user_admin_url(); 
    591591                        elseif ( is_multisite() && !$user->has_cap('read') ) 
    592592                                $redirect_to = get_dashboard_url( $user->id ); 
  • wp-includes/link-template.php

     
    23022302        $user_id = (int) $user_id; 
    23032303 
    23042304        $blogs = get_blogs_of_user( $user_id ); 
    2305         if ( empty($blogs) ) { 
     2305        if ( ! is_super_admin() && empty($blogs) ) { 
    23062306                $url = user_admin_url( $path, $scheme ); 
    23072307        } elseif ( ! is_multisite() ) { 
    23082308                $url = admin_url( $path, $scheme ); 
    23092309        } else { 
    23102310                $current_blog = get_current_blog_id(); 
    2311                 if ( $current_blog  && in_array($current_blog, array_keys($blogs)) ) { 
     2311                if ( $current_blog  && ( is_super_admin( $user_id ) || in_array( $current_blog, array_keys( $blogs ) ) ) ) { 
    23122312                        $url = admin_url( $path, $scheme ); 
    23132313                } else { 
    23142314                        $active = get_active_blog_for_user( $user_id );