Skip to:
Content
Pages
Categories
Search
Top
Bottom

Re: Making Member/Group Lists Require Log-In


Will White
Participant

@willpcg

I don’t mean to dig up a several day old thread but I’ve been working with the code I found on the post’s second page and still seem to have the same difficulty. I think I may be doing something wrong with bp-custom.php itself – not necessarily the code.

Here’s what I did, maybe you could take a second and look to see if I made an obvious mistake?

I didn’t have a bp-custom.php file in either the plugins or mu-plugins folders so I created one from scratch.

With an empty page open I added the following code:

<?php

/**
* Plugin Name: bp-custom
* Description: Custom Scripting for Securing Member and Group Directories
* Version: 1.0
*/

function js_restrict_access(){
global $bp, $bp_unfiltered_uri;

if (!is_user_logged_in() &&
(BP_MEMBERS_SLUG == $bp_unfiltered_uri[0] ||
BP_GROUPS_SLUG == $bp->current_component ||
BP_BLOGS_SLUG == $bp->current_component)){

bp_core_redirect( get_option('home') . "/register" );

}
add_action( 'wp', 'js_restrict_access', 3 );

?>

I saved the php document as bp-custom.php

I uploaded it to the wp-content/plugins directory.

(I also tried wp-content/mu-plugins directory.)

I went to log in and see if I needed to activate it – nothing shows up on the screen period – even on the dashboard.

Just in case it’s relevant I’m running:

I’m running WPMU 2.7.1 and BP 1.0.1

Thanks in advance for any help.

Skip to toolbar