slawrenson
Member
Posted 5 months ago #
hiya
I've been searching for a solution to this but as yet I haven't found a simple one. I'd simply like to password protect all access to a subdomain running WP 3.3 and BuddyPress 1.5. I've used a few plugins but these wither do not work on MU or only protect the main domain.
Can anyone help?
Rod Whiteley
Member
Posted 5 months ago #
Here is a crude solution that I have not tested much.
In wp-content I added a directory named mu-plugins, then in mu-plugins I added a file named protect.php, then in protect.php I wrote:
<?php
function ss_redirect () {
if (!is_user_logged_in()) auth_redirect();
}
if ($blog_id == 2) add_action('template_redirect', 'ss_redirect');
?>
This protects the site whose blog ID is 2. You'll probably want to change the 2 to something else. To find a site's blog ID, go to your Network Admin – Sites page and look at the site's Edit URL.
There's 2 privacy plugins specifically for multisite that will block access to any site in the network.
Network Privacy is one, More Privacy is the other.