BuddyDev

Search

Replies

  • Participant
    Level: Initiated
    Posts: 1
    Zigomar on #40092

    HI,
    I doesn’t work with your snippet below. I tried to remove it for one of my two member types. Still showing.
    I just want the “Add Create Group sub nav to User Profile->Groups screen” for one member type only.

    Thanks

    /**
    * Add Create Group sub nav to User Profile->Groups screen
    */
    function buddydev_custom_add_create_group_tab_to_profile_nav() {

    if ( ! bp_is_my_profile() ) {
    return;
    }
    $slug = bp_get_groups_slug();
    $access = bp_core_can_edit_settings() && bp_user_can_create_groups();
    $groups_link = trailingslashit( bp_core_get_user_domain() . $slug );

    bp_core_new_subnav_item(
    array(
    ‘name’ => __( ‘Create’ ),
    ‘slug’ => ‘create-group’,
    ‘parent_slug’ => $slug,
    ‘parent_url’ => $groups_link,
    ‘position’ => 1010,
    ‘user_has_access’ => $access,
    ‘screen_function’ => function () {
    },
    ‘show_in_admin_bar’ => false,
    ‘link’ => trailingslashit( bp_get_groups_directory_permalink() . ‘create’ ),
    )
    );
    }

    add_action( ‘bp_groups_setup_nav’, ‘buddydev_custom_add_create_group_tab_to_profile_nav’, 100 );