Skip to:
Content
Pages
Categories
Search
Top
Bottom

Forum Replies Created

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

  • dan77
    Member

    @dan77

    try this one:
    http://pastebin.com/rgJ6BQc8

    logged in users only, private site. code needs to go into a bp-custom.php in your plugin directory.


    dan77
    Member

    @dan77

    a solution without plugin for a private community, logged-in users only:
    I used the code of david carson described in this thread:
    https://wordpress.org/support/topic/theme-frisco-for-buddypress-login-in-home-page?replies=18

    here is the code you need to paste in a bp-custom.php in you plugin directory.
    (you have to create it if you don’t have it).
    Note: that not logged in users are redirected to slug/register page, you have to change it if your register page has a different URL.


    <?php

    // **** Privacy ********
    function restrict_access(){
    global $bp, $bp_unfiltered_uri;

    // If user is not logged in and
    if (!is_user_logged_in() &&
    (
    // The current page is not register or activation
    !bp_is_register_page() &&
    !bp_is_activation_page()
    )

    ) {
    // Redirect to registration page. Change /register to your register page slug
    bp_core_redirect( get_option('home') . '/register' );
    }
    }

    add_action( 'wp', 'restrict_access', 3 );

    http://pastebin.com/rgJ6BQc8


    dan77
    Member

    @dan77

    if you want complete private community I used the code of david carson described in this thread:
    https://wordpress.org/support/topic/theme-frisco-for-buddypress-login-in-home-page?replies=18

    here is the code you need to paste in a bp-custom.php in you plugin directory.
    Note: that not logged in users are redirected to slug/register page, you have to change it if your register page has a different URL.

    ‘<?php

    // **** Privacy ********
    function restrict_access(){
    global $bp, $bp_unfiltered_uri;

    // If user is not logged in and
    if (!is_user_logged_in() &&
    (
    // The current page is not register or activation
    !bp_is_register_page() &&
    !bp_is_activation_page()
    )

    ) {
    // Redirect to registration page. Change /register to your register page slug
    bp_core_redirect( get_option(‘home’) . ‘/register’ );
    }
    }

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

    http://pastebin.com/rgJ6BQc8

Viewing 3 replies - 1 through 3 (of 3 total)
Skip to toolbar