If you run a BuddyPress site which is for a defined group, it is always a better idea to keep it private or in any case restricting BuddyPress for members only is a great idea to minimize spam.

So, if you want to lock down your BuddyPress setup and give access to members only, the below mentioned snippet will do the trick for you.

Also Read: 20+ Best BuddyPress Themes

This code will make all BuddyPress pages private, except the registration and activation pages. It also leaves all blog pages public. It’s a bit easier than editing all theme pages.

Place the function below into functions.php in your theme folder.

function sh_walled_garden()
{
global $bp;

if ( bp_is_register_page() || bp_is_activation_page() )
return;

if( ! bp_is_blog_page() && ! is_user_logged_in()  )
bp_core_redirect( $bp->root_domain .'/'. BP_REGISTER_SLUG );
}
add_action( 'walled_garden', 'sh_walled_garden' );

and this right on top of header.php (before the <!DOCTYPE… parts):

<?php do_action( 'walled_garden' ) ?>

Script courtesy: BuddyPress.org

Now, if you are a new user and don’t have any idea about codes and files on your site we have a great solution for you, a plugin which will do exactly what you are looking for.

BuddyPress for Members Only

BuddyPress Members Only is a plugin which restricts your BuddyPress  setup open for logged in/registered members only. Only registered/logged in users can view your site, non members can only open home page/login/register/lost password pages. Logged in users have full access.

BuddyPress for Members Only

If a users who not logged in, he can view home page, but when he try to view any other BuddyPress content, he will be redirected to optionally URL which can be setting in admin panel.

This is a great and very useful plugin for any BuddyPress users, we believe restricting a BuddyPress for members only will help to minimize spam to a great extent also you have option to improve brand value by creating a great looking login/register page & redirect new users to that page.

Download Plugin

How to Restrict BuddyPress for Members Only
IndexWP Ratings98%
User Ratings97%
Usability96%
97%Overall Score
Reader Rating: (3 Votes)
37%

One Response

Leave a Reply

Your email address will not be published.

Grow Your Traffic To 40,000/Month

Learn the 6 plugins we used to grow our own traffic from 0 to 40,000 a month within a year.

We never share your E Mail ID with anyone

Grow Your Traffic To 40,000/Month

Learn the 6 plugins we used to grow our own traffic from 0 to 40,000 a month within a year.

We never share your E Mail ID with anyone