About

Welcome to the example site for the BuddyPress Private Community Plugin. This site is using the plugin to restrict access to this demo community.

What modes does this plugin have?

There are now two modes. The default mode is:

MM_BUDDYPRESS_PRIVATE_COMMUNITY::$MODE = MM_BUDDYPRESS_PRIVATE_COMMUNITY::MODE_BLOCK_ALL_AND_ALLOW_SOME_URIS;

This blocks logged out users from accessing your private community pages, but you’re able to set pages/areas of your site that are public using an array of allowed URIs:

MM_BUDDYPRESS_PRIVATE_COMMUNITY::$ALLOWED_URIS 		= Array('/about', '/about/*', '/public-page');
Notice, '/about/*' allows access to all pages starting with '/about/' because of the special character *.

The new alternative mode is:

MM_BUDDYPRESS_PRIVATE_COMMUNITY::$MODE = MM_BUDDYPRESS_PRIVATE_COMMUNITY::MODE_BLOCK_NONE_AND_NOT_ALLOW_SOME_URIS;

This does the opposite. It allows logged out users access to your site, but you’re able to make some pages private using the following array in the config file:

MM_BUDDYPRESS_PRIVATE_COMMUNITY::$NOT_ALLOWED_URIS		= Array('/private-page*');

This demo site is using the default mode.

What does this demo site show me?

Well, you can try clicking on the tabs above. You’ll notice that clicking on the Home, Activity, Members, Groups, Events and Private Page will redirect you to this page again.

The plugin is set-up to redirect logged out users to this, About, page. You’ll notice that after you click on one of the private pages, there is an extra “on_login_redir_to=/some/page” in the URL. This is used to store what page you tried to access before being redirected.

If you then go on to login to the community (you’ll have to take my word for this as logins are not allowed in this demo site), you will be redirected to the page stored in the “on_login_redir_to=” parameter.

This is a useful feature as many of your members might access your site from links in emails to private pages when they are logged out. So, they would be redirect to the default landing page, the About page in this case, and then after logging in, they would be redirected automatically to content they were originally trying to access. This helps the plugin to seamlessly integrate into your BuddyPress site.

Also, you’ll notice that clicking on the About tab or Public Page Tab will take you straight to the page with no redirect or extra ‘on_login_redir_to’ hook added. This is of course because these pages have be defined as public pages in the plugin’s config file.

What config file is this demo site using?

Here is the config file used in this site.

<?php 
MM_BUDDYPRESS_PRIVATE_COMMUNITY::$WP_SUB_FOLDER			= 'bppc_test';
MM_BUDDYPRESS_PRIVATE_COMMUNITY::$ALLOWED_URIS			= Array('/about', '/about/*', '/public-page');
MM_BUDDYPRESS_PRIVATE_COMMUNITY::$REDIRECT_TO_URL		= site_url('/about');
MM_BUDDYPRESS_PRIVATE_COMMUNITY::$REDIRECT_HOOK			= 'on_login_redir_to';
MM_BUDDYPRESS_PRIVATE_COMMUNITY::$ALLOWED_WIDGET_IDS	= Array('pages-4');

This line of the config file sets the allowed public pages on this site:

MM_BUDDYPRESS_PRIVATE_COMMUNITY::$ALLOWED_URIS			= Array('/about', '/about/*', '/public-page');

This line sets the default redirect to page / landing page. NOTE: The redirect to url must be a public page listed above! Otherwise you’ll get a infinite redirect loop error.

MM_BUDDYPRESS_PRIVATE_COMMUNITY::$REDIRECT_TO_URL		= site_url('/about');

We’ve changed the default redirect hook for this demo too, you’ll see this value in the url after you try to access a private page.

MM_BUDDYPRESS_PRIVATE_COMMUNITY::$REDIRECT_HOOK			= 'on_login_redir_to';

For information on setting up a config file, go to the plugin’s FAQs on the WordPress Site or BuddyPress Site.

Why can I see only one side menu widget?

By default this plugin blocks all widgets from logged out users. But, you are able to allow all widgets or individual widgets in the config file. All you have to do to allow individual widgets to be displayed when the user is logged out, is to add the widget’s id to an array of allowed widget ids in the config file:

MM_BUDDYPRESS_PRIVATE_COMMUNITY::$ALLOWED_WIDGET_IDS	= Array('pages-4');
This array is only used when in the default "MM_BUDDYPRESS_PRIVATE_COMMUNITY::MODE_BLOCK_ALL_AND_ALLOW_SOME_URIS" mode.

How can I find a widget’s id?

You can right click on a widget in Chrome or FireFox, then select inspect element to view the HTML. Find the widget’s main div and the id attribute value should be the widget’s id. E.g. on this page:

<div id="page-4">(widget)</div>

What happens to my widgets when in the alternative mode?

In the alternative mode, the plugin sets up your site to be public, but you can restrict certain areas of your site. This is the same for the widgets, all of them are made public, then you can set which ones you’d like to make private using:

MM_BUDDYPRESS_PRIVATE_COMMUNITY::$NOT_ALLOWED_WIDGET_IDS 	= Array('pages-4');
This array is only used when in the "::MODE_BLOCK_NONE_AND_NOT_ALLOW_SOME_URIS" mode.

What about the RSS & ATOM feeds?

This plugin automatically blocks all standard BP and WP feeds. Try viewing the feeds and see what happens: Activity Feed.

You should see a message telling you that the site is private and the feeds have been disabled. You are able to alter these messages in the config file to your own messages. See the plugins FAQs or the example config file in the plugin’s download for examples.

You can also not block all feeds if you wish too.

How flexible is this plugin?

This plugin can be customized and set-up to meet your needs. Once you get the hang of the config file, I’m sure you’ll be able to make this plugin work for your private community.

How can I allow auto-registration?

To allow users to register new accounts on your private site, you can use a config file like below:

MM_BUDDYPRESS_PRIVATE_COMMUNITY::$ALLOWED_URIS  = Array(
// your choice of landing page
'/my-landing-page',
// Allow access to the registration form
'/register',
// Allow access to the account activation URIs. The wildcard character * allows all activation codes to be accepted as valid URIs.
'/activate?key=*'
);
// Redirect to a public page
MM_BUDDYPRESS_PRIVATE_COMMUNITY::$REDIRECT_TO_URL       = site_url('my-landing-page'); 

What does this plugin require?

This plugin requires PHP 5.

How does this plugin affect admin pages?

This plugin doesn’t alter how the WP Admin area works and handles logged out users. This plugin only affects the actual site pages. The native WP login is also not affected by this plugin.