Skip to:
Content
Pages
Categories
Search
Top
Bottom

Making Member/Group Lists Require Log-In

  • @willpcg

    Participant

    Is there any way that I can make the Member and Group Directories require the user be logged in to see it? I would imagine its got to be similar to how private pages are handled.

    Also, is there any known way to allow open sign-up for the network, but require moderator’s approval before the account can gain access to the pages?

    Thanks!

Viewing 9 replies - 1 through 9 (of 9 total)
  • @jeffsayre

    Participant

    Try this: https://buddypress.org/forums/topic.php?id=1651

    As far as your second, question, I don’t think that is currently possible. Perhaps someone else knows otherwise.

    @willpcg

    Participant

    As always, thank you very much Jeff. Hopefully they’ll come out with something where we can moderate who signs up soon.

    @willpcg

    Participant

    Ugh, I just implemented the bp-custom.php updates listed there and it causes my whole screen to go blank whenever I load up the page.

    I’ll have to look into this deeper on Monday.

    @jeffsayre

    Participant

    WillPCG-

    Some people reported issues when upgrading from RC1 to RC2. There were a few fixes on the second page of that thread. Make sure you read the entire thread.

    @willpcg

    Participant

    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.

    @takeo

    Participant

    I wonder if this thread:

    https://buddypress.org/forums/topic.php?id=1651

    should be made ‘sticky’?

    @willpcg

    Participant

    Its definitely got alot of great info on it. I’m not sure I’m having issues with the actual code or with the implementation of bp-custom.php though – hence the response to Jeff after he linked me that page.

    @jeffsayre

    Participant

    @WillPCG

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

    You did the right thing. It does not exist unless you create it!

    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.

    The file bp-custom.php needs to be placed in /plugins/. You cannot activate it. It automatically is loaded by bp-core.php as the first required file if it exists in that location.

    As far as the code to put in bp-custom.php, try something like this:

    <?php
    function restrict_access(){
    global $bp, $bp_unfiltered_uri;

    if (!is_user_logged_in() &&
    ($bp_unfiltered_uri[0] == BP_MEMBERS_SLUG ||
    $bp_unfiltered_uri[0] == BP_GROUPS_SLUG))
    {
    bp_core_redirect( get_option('home') . "/register" );
    }
    }
    add_action( 'wp', 'restrict_access', 3 );
    ?>

    @kunal17

    Participant

    Thanks for the code. I there a way to restrict only a particular group and not all?

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Making Member/Group Lists Require Log-In’ is closed to new replies.
Skip to toolbar