Skip to:
Content
Pages
Categories
Search
Top
Bottom

How to make pages like Groups, Forums, members and updates only accessible to members?

  • @hanss

    Participant

    Just like the title says: How to make pages like Groups, Forums, members and updates only accessible to members? I don’t want random visitors to be able to see the forum posts, the activity of the members and so on.

Viewing 4 replies - 26 through 29 (of 29 total)
  • @gvdsleen

    Member

    great answer, waiting for BP1.3.

    Just to clarify, if i only want to disable http://www.mysite.com/members for level0 membership, in which .php file should I add the code you provided?

    Should it go in: index.php in the mytheme/members/ folder? In that case, that file has no

    tag:

    as i said, no code guru ;)

    @gvdsleen

    Member

    OK, answer is yes. Solution works fine. Thanks for the great support! Any change of redirecting to the membership options page in stead of showing in page content?

    @boiy

    Participant

    @pcwriter, its a good solution, i particularly like it simple too.. but one problem tho… i just hope it wont be hacked easily, and secondly i hope this can come out better as a function so one can easily apply it to all pages at once

    its kool work

    @jsepkenya

    Participant

    add this to your theme functions
    to redirect to wherever

    ///////////////////////////////////////////////////////////////////////
    /// check if is friend
    ///////////////////////////////////////////////////////////////////////
    function bp_displayed_user_is_friend() {
    global $bp;
    $friend_privacy_enable = “enable”;
    $friend_privacy_redirect = ‘http://yourdomain.com/members’;

    if($friend_privacy_enable == “enable”) {
    if ( bp_is_profile_component() || bp_is_member() ) {
    if ( (‘is_friend’ != BP_Friends_Friendship::check_is_friend( $bp->loggedin_user->id, $bp->displayed_user->id )) && (bp_loggedin_user_id() != bp_displayed_user_id()) ) {
    if ( !is_super_admin( bp_loggedin_user_id() ) ) {
    if($friend_privacy_redirect == ”) {
    bp_core_redirect( $bp->root_domain );
    } else {
    bp_core_redirect( $friend_privacy_redirect );
    }
    }
    }
    }
    } //enable
    }
    add_filter(‘get_header’,’bp_displayed_user_is_friend’,3);

    ///////////////////////////////////////////////////////////////
    // check privacy
    ////////////////////////////////////////////////////////////////

    function check_if_privacy_on() {
    global $bp;
    $location = $_SERVER[‘HTTP_REFERER’];
    $privacy_enable = “enable”;
    $privacy_redirect = ‘http://your domain.com/login/’ ;
    if($privacy_enable == “enable”) {
    if ( bp_is_profile_component() || bp_is_activity_component() || bp_is_page( BP_MEMBERS_SLUG ) || bp_is_member() ) {
    if(!is_user_logged_in()) {
    if($privacy_redirect == ”) {
    bp_core_redirect( $bp->root_domain . ‘/’ . BP_REGISTER_SLUG . ‘/’ );
    } else {
    bp_core_redirect( $privacy_redirect ) ;
    }
    }
    }
    } //off
    }

    add_filter(‘get_header’,’check_if_privacy_on’, 1);

    function check_if_create_group_limit() {
    global $bp;
    $create_limit_enable = “yes”;
    $create_limit_redirect = ‘http://yourdomain.com/groups’;
    if($create_limit_enable == “yes”) {
    if( bp_is_group_create() ) {
    if ( current_user_can( ‘delete_others_posts’ ) ) { //only admins and editors
    } else {
    if( $create_limit_redirect == ” ) {
    bp_core_redirect( $bp->root_domain . ‘/’ );
    } else {
    bp_core_redirect( $create_limit_redirect );
    }
    }
    }

    } //off
    }
    add_filter(‘get_header’,’check_if_create_group_limit’,2);

    for all pages created with buddypress level 1 i hope is all u want to restrict

Viewing 4 replies - 26 through 29 (of 29 total)
  • The topic ‘How to make pages like Groups, Forums, members and updates only accessible to members?’ is closed to new replies.
Skip to toolbar