diff --git a/wp-admin/includes/ms.php b/wp-admin/includes/ms.php index 8458526496..13a5c12cbd 100644 --- a/wp-admin/includes/ms.php +++ b/wp-admin/includes/ms.php @@ -496,26 +496,41 @@ function sync_category_tag_slugs( $term, $taxonomy ) { } add_filter( 'get_term', 'sync_category_tag_slugs', 10, 2 ); -function redirect_user_to_blog() { - $c = 0; - if ( isset( $_GET['c'] ) ) - $c = (int) $_GET['c']; +function _access_denied_splash() { + if ( ! is_user_logged_in() ) + return; - if ( $c >= 5 ) { - wp_die( __( "You don’t have permission to view this site. Please contact the system administrator." ) ); + $blogs = get_blogs_of_user( get_current_user_id() ); + + $blog_name = get_bloginfo( 'name' ); + + if ( empty( $blogs ) ) { + wp_die( sprintf( __( 'You attempted to access the "%s" dashboard, but you do not currently have privileges on this site. If you believe you should be able to access the "Test" dashboard, please contact your network administrator.' ), $blog_name ) ); + exit; } - $c ++; - $blog = get_active_blog_for_user( get_current_user_id() ); + $output = '
' . sprintf( __( 'You attempted to access the "%s" dashboard, but you do not currently have privileges on this site. If you believe you should be able to access the "Test" dashboard, please contact your network administrator.' ), $blog_name ) . '
'; + $output .= '' . __( 'If you reached this screen by accident and meant to visit one your own sites, here are some shortcuts to help you find your way.' ) . '
'; - if ( is_object( $blog ) ) { - wp_redirect( get_admin_url( $blog->blog_id, '?c=' . $c ) ); // redirect and count to 5, "just in case" - } else { - wp_redirect( user_admin_url( '?c=' . $c ) ); // redirect and count to 5, "just in case" + $output .= '"; + $output .= "{$blog->blogname}"; + $output .= " | "; + $output .= ""; + $output .= "" . __( 'Visit Dashboard' ) . " | " . __( 'View Site' ) . "" ; + $output .= " | "; + $output .= "