- 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"
+ $blog_name = get_bloginfo( 'name' );
+
+ if ( empty( $blogs ) )
+ wp_die( sprintf( __( 'You attempted to access the "%1$s" dashboard, but you do not currently have privileges on this site. If you believe you should be able to access the "%1$s" dashboard, please contact your network administrator.' ), $blog_name ) );
+
+ $output = '<p>' . sprintf( __( 'You attempted to access the "%1$s" dashboard, but you do not currently have privileges on this site. If you believe you should be able to access the "%1$s" dashboard, please contact your network administrator.' ), $blog_name ) . '</p>';
+ $output .= '<p>' . __( 'If you reached this screen by accident and meant to visit one of your own sites, here are some shortcuts to help you find your way.' ) . '</p>';
+
+ $output .= '<h3>' . __('Your Sites') . '</h3>';
+ $output .= '<table>';
+
+ foreach ( $blogs as $blog ) {
+ $output .= "<tr>";
+ $output .= "<td valign='top'>";
+ $output .= "{$blog->blogname}";
+ $output .= "</td>";
+ $output .= "<td valign='top'>";
+ $output .= "<a href='" . esc_url( get_admin_url( $blog->userblog_id ) ) . "'>" . __( 'Visit Dashboard' ) . "</a> | <a href='" . esc_url( get_home_url( $blog->userblog_id ) ). "'>" . __( 'View Site' ) . "</a>" ;
+ $output .= "</td>";
+ $output .= "</tr>";