Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Check User is a Blog User on Network Site
<?php
/* protects site from those who are not assigned to it */
function mdw_user_has_blog_role() {
/* get the global blog id */
global $blog_id;
/* check user is part of this blog, and die if they are not */
if( ! is_blog_user( $blog_id ) )
wp_die( __("You are trying to access a site that you are not allowed to see. Naughty you!") );
}
add_action( 'init', 'mdw_user_has_blog_role' );
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment