Ticket #17121: 17121.diff
| File 17121.diff, 2.2 KB (added by , 15 years ago) |
|---|
-
wp-admin/includes/ms.php
496 496 } 497 497 add_filter( 'get_term', 'sync_category_tag_slugs', 10, 2 ); 498 498 499 function redirect_user_to_blog() { 500 $c = 0; 501 if ( isset( $_GET['c'] ) ) 502 $c = (int) $_GET['c']; 499 function _access_denied_splash() { 500 if ( ! is_user_logged_in() ) 501 return; 503 502 504 if ( $c >= 5 ) { 505 wp_die( __( "You don’t have permission to view this site. Please contact the system administrator." ) ); 503 $blogs = get_blogs_of_user( get_current_user_id() ); 504 505 $blog_name = get_bloginfo( 'name' ); 506 507 if ( empty( $blogs ) ) { 508 wp_die( sprintf( __( 'You have reached the dashboard of "%s" but have no privileges on this site. Please ask an administrator to add you to this one.' ), $blog_name ) ); 509 exit; 506 510 } 507 $c ++;508 511 509 $ blog = get_active_blog_for_user( get_current_user_id());512 $output .= sprintf( __( 'You have reached the dashboard of "%s" but have no privileges on this site. Please visit one of your own dashboards or ask an administrator to add you to this one.' ), $blog_name ); 510 513 511 if ( is_object( $blog ) ) { 512 wp_redirect( get_admin_url( $blog->blog_id, '?c=' . $c ) ); // redirect and count to 5, "just in case" 513 } else { 514 wp_redirect( user_admin_url( '?c=' . $c ) ); // redirect and count to 5, "just in case" 514 $output .= '<h3>' . __('Your Sites') . '</h3>'; 515 $output .= '<table>'; 516 517 foreach ( $blogs as $blog ) { 518 $output .= "<tr>"; 519 $output .= "<td valign='top'>"; 520 $output .= "{$blog->blogname}"; 521 $output .= "</td>"; 522 $output .= "<td valign='top'>"; 523 $output .= "<a href='" . esc_url( get_home_url( $blog->userblog_id ) ). "'>" . __( 'Visit' ) . "</a> | <a href='" . esc_url( get_admin_url( $blog->userblog_id ) ) . "'>" . __( 'Dashboard' ) . "</a>"; 524 $output .= "</td>"; 525 $output .= "</tr>"; 515 526 } 527 $output .= '</table>'; 528 529 wp_die($output); 516 530 exit; 517 531 } 518 add_action( 'admin_page_access_denied', ' redirect_user_to_blog', 99 );532 add_action( 'admin_page_access_denied', '_access_denied_splash', 99 ); 519 533 520 534 function check_import_new_users( $permission ) { 521 535 if ( !is_super_admin() )