_access_denied_splash ( No parameters )
Access
Private
定义位置
  • wp-admin/includes/ms.php
    , line 553
引入
3.2.0
弃用

Displays an access denied message when a user tries to view a site’s dashboard they
do not have access to.

function _access_denied_splash() {
	if ( ! is_user_logged_in() || is_network_admin() ) {
		return;
	}

	$blogs = get_blogs_of_user( get_current_user_id() );

	if ( wp_list_filter( $blogs, array( 'userblog_id' => get_current_blog_id() ) ) ) {
		return;
	}

	$blog_name = get_bloginfo( 'name' );

	if ( empty( $blogs ) ) {
		wp_die(
			sprintf(
				/* translators: 1: Site title. */
				__( '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
			),
			403
		);
	}

	$output = '

' . sprintf( /* translators: 1: Site title. */ __( '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 .= '

' . __( '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.' ) . '

'; $output .= '

' . __( 'Your Sites' ) . '

'; $output .= '
‘;

foreach ( $blogs as $blog ) {
$output .= ‘

‘;
$output .= “

“;
$output .= ‘

‘;
$output .= ‘

‘;
}

$output .= ‘

{$blog->blogname} ‘ . __( ‘Visit Dashboard’ ) . ‘ | ‘ .
” . __( ‘View Site’ ) . ‘

‘;

wp_die( $output, 403 );
}