And in the interest of sharing, here is where my additional code stands now in the pursuit of a locked down network site:
add_action( 'wp', 'walled_garden' );
function walled_garden() {
if ( is_user_logged_in() && !current_user_can('manage_options') && !is_user_member_of_blog() && !is_page('error')) {
wp_redirect(site_url('/error'));
exit;
}
}
function error_link() {
if(is_user_logged_in()&& !is_user_member_of_blog()) {
global $current_user;
$blogs = get_blogs_of_user( $current_user->id );
if($blogs) {
foreach ( $blogs as $blog ) {
echo '<strong>ERROR:</strong> You do not currently have permission to view this network. Please click<a href="https://' . $blog->domain . $blog->path .'"> here </a> to go to your network';
}
}
}
else {
echo 'Hey! How did you get here?';
}
}
add_shortcode('errortext', 'error_link');
Again, I tagged this onto my private site plugin, based on jonradio’s “jonradio Private Site” plugin. (I listed my changes in a thread in that plugin’s support forum) Now, however, it allows you to redirect members of other blogs to an error page if they try to get into another site’s “walled garden.” This error page will tell them they don’t have access and give them a link to their network. (Since I’m only letting people sign up for one blog at a time, the way I did this shouldn’t be an issue, but you could modify the code to reset the array to only output the first result…OR just echo the array as a list if you have members who belong to other blogs)
…and then as an Easter egg, there’s a customizable message if a member with access to a blog manually types in “error” after the link. For now, I just left mine as “Hey! How did you get here?”
Hopefully someone out there can use this. If not, at least it’s useful to me. If anyone has any suggestions or additions, feel free to add them.
-Nick
EDIT: Since I realize I didn’t make it clear, this requires you to create a page on your sites called “error” and simply place the shortcode [errortext] on it. Through a hack or a plugin, then, just remove the link to the page from the navigation. Quick, dirty, and dead simple.