Skip to:
Content
Pages
Categories
Search
Top
Bottom

how to make buddypress private


  • perry_n
    Participant

    @perry_n

    Hi

    I’m currently new to buddypress, i’ve installed it, got it up and running and it looks like a great piece of kit but is there a way of making it private kind of like facebook. i would like a landing page for the user to either login or register and when they log in they see all the widgets and everything else. at the moment anyone that goes on to the site can see all the members, groups, activities, etc whether they are logged in or not.

    i am running buddypress 2.2.1. i have seen other solutions out there but it seems they are for older versions.

    i would be extremely thankful for a solution.

Viewing 4 replies - 1 through 4 (of 4 total)

  • Azalea Mollis
    Participant

    @azaleamollis

    I don’t know if there’s a good plugin for this but you can add a custom function to your bp-custom.php file that achieves the same result. You can read how to make a bp-custom.php file here in the BP Codex.

    When your bp-custom.php file is ready, you add this function to the file:

    
    <?php
    function restrict_bp_pages() {
    	
    	global $bp;
    	
    	if( bp_is_blog_page() || bp_is_register_page() || bp_is_activation_page() ) {
    		return;
    	}
    	
    	if( !is_user_logged_in() ) {
    		bp_core_redirect( $bp->root_domain .'/YOUR-LOGIN-SLUG' );
    	}	
    	
    }
    add_action( 'get_header', 'restrict_bp_pages' );

    You insert the slug of your login page in the place of YOUR-LOGIN-SLUG into the code above. E.g. if your login page is http://www.mypage.com/mylogin, your insert ‘/mylogin’. If you want to use your home page you leave out this part and only use bp_core_redirect( $bp->root_domain );.

    Then you upload the bp-custom.php file into the /wp-content/plugins/ folder on your server, and you’re ready.


    IHaveToDoThis
    Participant

    @ihavetodothis

    Hey,

    I’m pretty new to BP myself, started my site about two weeks ago. I use the Absolute Privacy plugin. You can lockdown the complete site or include a members area. What’s great about this plugin is that you can put the page ID of pages that you still want to visible to logged out users. So, for example, while logged out my users can still access the registration page, our about page, a history page and our terms and service. Other than that all other pages clicked on send them to the login page or whichever page you designate.

    Important note: You need a plugin that will show you the page ID numbers for your pages. There’s someway to find it on WP but no one on the forums explained it in a way I could understand. I use Reveal IDs. Really simple install and the IDs show up right on your pages panel. Overall the Absolute Privacy plugin was worth the double download.

    I hope this helps. If not, I think I have the names of some the other plugins I used but didn’t work for me. Maybe they might for you. Anyways, good luck!


    danbp
    Participant

    @danbp

    To get a page ID, simply mouse over the page title on the page list and you can see it in the bottom left corner of your brower.
    Someting like this:
    ../wp-admin/post.php?post=23&action=edit where “23” is the page ID. This number means post_type ID, so there is no difference between a post ID or a page ID except the post_type itself.

    Ref: https://codex.wordpress.org/Function_Reference/get_pages


    IHaveToDoThis
    Participant

    @ihavetodothis

    Hey Dan,

    You’re right. Thanks for the simple explanation!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘how to make buddypress private’ is closed to new replies.
Skip to toolbar