Skip to:
Content
Pages
Categories
Search
Top
Bottom

Protecting Buddypress pages from non-logged in users.

  • @marutim

    Participant

    Hi All,

    I want to protect all (if can choose from all then would be great) Buddypress pages from non logged in users.
    From all I mean anything associated with Buddypress like forums, activity page, members etc and also other pages which might be created on fly.

    From protection i mean the non-logged in users should not be able to see/browse the page even if they have the precise link to the page (only a logged in user should be able to see/browse it)

    I have found this plugin, but donot know if this can protect my BP pages too.
    http://wordpress.org/extend/plugins/private-post-by-default/

    and http://wordpress.org/extend/plugins/private-buddypress/
    but the private buddypress plugin seems like is no more supported and is compatible to WP 3.1 and BP 1.3

    Can some one please help or share some ideas?

    Thanks in Advance

Viewing 14 replies - 1 through 14 (of 14 total)
  • @giannisff

    Participant

    Hi,
    I think that this link will help you. Have a look at this http://wpmu.org/how-to-build-a-facebook-style-members-only-wordpress-buddypress-site/

    @drill_sgtlewis

    Participant

    Another simpler approach would be to created a bp-custom.php and place it in the plugins directory and add the following code
    `<?php
    function bp_guest_redirect() {
    global $bp;
    if ( bp_is_activity_component() || bp_is_groups_component() /*|| bbp_is_single_forum()*/ || bp_is_forums_component() || bp_is_blogs_component() || bp_is_page( BP_MEMBERS_SLUG ) ) {
    // enter the slug or component conditional here
    if(!is_user_logged_in()) { // not logged in user
    wp_redirect( get_option(‘siteurl’) . ‘/register’ );
    } // user will be redirect to any link to want
    }
    }
    add_filter(‘get_header’,’bp_guest_redirect’,1);
    ?>`
    This code will work to hide buddypress pages and group forums as is, if your using sitewide forums in line 4 remove the comments around:
    || bbp_is_single_forum()
    Save and refresh. Works in current versions.

    @marutim

    Participant

    @giannisff I would definitely consider that solution.

    @drill your solutions works, only for the respective pages but what about the pages that are created on the fly .. for example when I tried to browse site_url/membsers/x/profile I get to see it.

    Any idea about this issue?

    Anyways thanks both of you for stopping by and replying 🙂

    @paintermommy

    Participant

    I am interested in finding out the answer for this as well.

    @chouf1

    Participant

    @echofoxtrot

    Participant

    Hi, @drill_sgtlewis – that looks great. Where do I put that bp-custom.php file? In the buddypress plugin root?

    @ubernaut

    Participant

    plugins folder

    @bphelp

    Participant

    @echofoxtrot
    This plugin works and is more complete as far as building a private community.
    https://github.com/bphelp/private_community_for_bp

    @echofoxtrot

    Participant

    Thanks! I just need to protect Groups and the Forum, not the whole site. I’ll give this code a shot.

    @naplpm

    Participant

    Hello,


    @drill_sgtlewis
    , can you tell me how can I adapt this code to avoid non-logged user to get to a specific page?

    I was trying something like this:

    function restrict_access(){
    global $bp, $bp_unfiltered_uri;
    $component = $bp->current_component;

    if (!is_user_logged_in() && ($component == “events”)
    ) {

    bp_core_redirect( “/home/” );

    }
    }

    add_action( ‘wp’, ‘restrict_access’, 3 );

    But it didn’t worked.

    Thanks

    @profc

    Participant

    Has someone found a solution to this issue? I also want to deny access to non-logged in users to group and members pages.

    I tried private_community_for_bp but I did not understand how to customize code since I want to leave generic users to vist 3 pages that do not belong to bp installation since, like site homepage

    @asdevargas

    Participant

    Hi! I tried with the plugin indicated by @chouf1 https://wordpress.org/extend/plugins/network-privacy/ but it doesn’t work properly (it let you see groups and members!) and the link provided by @bphelp doesn’t work 🙁
    Is there any other plugin option?

    @bphelp

    Participant

    @asdevargas
    I removed the github version in favor of using the version in the official WP repository which has been improved. You can get it here:
    https://wordpress.org/plugins/private-community-for-bp-lite/

    @asdevargas

    Participant

    And freshly updated 🙂 Thank you @bphelp!

Viewing 14 replies - 1 through 14 (of 14 total)
  • The topic ‘Protecting Buddypress pages from non-logged in users.’ is closed to new replies.
Skip to toolbar