Re: How to make a private community?
@r-a-y I used your code suggestion and some that I found in Restrict User 2 With Viper’s original Restrict User Plugin
Found here http://www.viper007bond.com/wordpress-plugins/registered-users-only/
because I wanted the site to be restricted to registered users only… still allow access to the login/activiate page and ALSO allow access to the feeds…
I ended up with this.
// Depending on conditions, run an authentication check
function MaybeRedirect() {
// If the user is logged in, then abort
if ( current_user_can(‘read’) ) return;
$settings = get_option( ‘registered-users-only’ );
// Feeds
if ( 1 == $settings && is_feed() ) return;
// This is a base array of pages that will be EXCLUDED from being blocked
if ($bp&&($bp->current_component == BP_REGISTER_SLUG ))//buddypress
return;
if ( bp_is_register_page() || bp_is_activation_page() || is_page(‘welcome’) ) //buddypress
return;
$this->exclusions = array(
‘wp-login.php’,
‘wp-signup.php’,
‘wp-register.php’,
‘wp-activate.php’,
‘wp-cron.php’, // Just incase
‘wp-trackback.php’,
‘wp-app.php’,
‘xmlrpc.php’,
);
It appears to be working… Do you have any thoughts on the above? Thanks