Skip to:
Content
Pages
Categories
Search
Top
Bottom

Restricting a group to members


  • Kunal17
    Participant

    @kunal17

    Can anyone suggest a mod which will allow me to enter a group id which will restrict the group access only to members (of BP not the group)? Another topic had the following code whcih allows all groups and member pages to be restricted, can anyone suggest how I would modify it to be specific only to a particular group?

    <?

    function js_restrict_access(){

    global $bp, $bp_unfiltered_uri;

    if (!is_user_logged_in() &&

    (BP_MEMBERS_SLUG == $bp_unfiltered_uri[0] ||

    BP_GROUPS_SLUG == $bp->current_component ||

    BP_BLOGS_SLUG == $bp->current_component)){

    bp_core_redirect( get_option(‘home’) . “/register” );

    }

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

    ?>

    Thanks! I know that a privacy component is being developed, but if a simple mod can be suggested, it would be very helpful while we wait for the full functionality.

Viewing 1 replies (of 1 total)

  • Brajesh Singh
    Participant

    @sbrajesh

    hi Kunal,

    Try this one.

    Put it inside a file in the mu-plugins folder

    <?
    function js_restrict_access(){
    global $bp, $bp_unfiltered_uri;

    if (!is_user_logged_in() &&(BP_GROUPS_SLUG == $bp->current_component )){

    bp_core_redirect( get_option('home') . "/register" );

    }
    }
    add_action( 'wp', 'js_restrict_access', 3 );
    ?>

    And It will work.Let me know if it works or not.

Viewing 1 replies (of 1 total)
  • The topic ‘Restricting a group to members’ is closed to new replies.
Skip to toolbar