Skip to:
Content
Pages
Categories
Search
Top
Bottom

How to show private group tab content everyone


  • tabarlyy
    Participant

    @tabarlyy

    Hi,
    here is the my code. tab is created,
    but if user not member this private group redirect to wp-login page. how to open everyone this tab?

    function custom_members_tab() {
    if ( bp_is_groups_component() && bp_is_single_item() ) {
    global $bp;
    $group_link = bp_get_group_permalink( $bp->groups->current_group );
    $tab_args = array(
    ‘name’ => esc_html__( ‘destination’, ‘default’ ),
    ‘slug’ => ‘destination-members’,
    ‘screen_function’ => ‘destination_members_screen’,
    ‘position’ => 60,
    ‘parent_url’ => $group_link,
    ‘parent_slug’ => $bp->groups->current_group->slug,
    ‘default_subnav_slug’ => ‘destination-members’,
    ‘item_css_id’ => ‘destination-members’,
    ‘access’ => ‘anyone’,
    ‘show_tab’ => ‘anyone’,
    ‘show_for_displayed_user’ => true
    );
    bp_core_new_subnav_item( $tab_args, ‘groups’ );
    }
    }
    add_action( ‘bp_setup_nav’, ‘custom_members_tab’ );

    function destination_members_screen() {
    add_action( ‘bp_template_content’, ‘custom_group_tab_content’ );
    bp_core_load_template( ‘buddypress/members/single/plugins’ );
    }
    function custom_group_tab_content() {
    echo “show non group members, guests, everyone”
    }

    I read this ticket, but I couldn’t understand how to use it.
    https://buddypress.trac.wordpress.org/ticket/4785

  • You must be logged in to reply to this topic.
Skip to toolbar