Skip to:
Content
Pages
Categories
Search
Top
Bottom

hide all content for non logged (with registered users only 2)


  • farandhigh
    Participant

    @farandhigh

    Wordpress : 3.4.2
    Buddypress : 1.6.1

    Hello,
    I’m trying to hide the content for non logged users, that they must redirect to a certain url that is the registration (called : /nouveau-membre),
    I’ve tried with registered users only 2 , but it don’t let me tell what the URL it must redirect to …
    Is there a solution ? or maybe something different that someone used to make the trick ?
    Thank you for the time,
    Oli

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

  • meg@info
    Participant

    @megainfo

    hi @farandhigh,

    with this code, you can create a private community, just logged members, can access to buddypress page.


    /**
    * Privacy
    * @return [type] [description]
    */
    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() &&
    // The current pas is not blog page
    !bp_is_blog_page() )
    // Redirect to registration page. Change /register to your register page slug
    bp_core_redirect( get_option('home') . '/register' );
    }

    // here, you can add som config paramt to check if private community is enabled
    add_action( 'wp', 'restrict_access', 3 );


    farandhigh
    Participant

    @farandhigh

    Thank you very much for your time,
    but it looks that it is unfortunatey not working … :-S
    The site is still accessible without loggin, but the page of login is now unaccessible due to too many redirections as it says …
    Don’t really know how to deal with that …
    the link is todaki . com (with the space for robots), and the login page is todaki . com / login
    maybe it can help ?
    Thanks in advance,
    Oli

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘hide all content for non logged (with registered users only 2)’ is closed to new replies.
Skip to toolbar