Skip to content

Instantly share code, notes, and snippets.

@wpmark
Created November 22, 2012 20:26
Show Gist options
  • Save wpmark/4132813 to your computer and use it in GitHub Desktop.
Save wpmark/4132813 to your computer and use it in GitHub Desktop.
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