This topic has 2 replies, 2 voices, and was last updated 7 years by pandreas82.

  • Author
  • #96010
     pandreas82
    Participant

    Hello all,

    I have managed to add a custom link to group pages navigation menu in the last position. The link is to a certain category archive page.
    Custom code is above (I have connected groups with a category, so the code somehow finds the term_id in order to be printed as the category link)

    COPY CODE
    function add_posts_category_to_group_nav() {
        if ( ! is_user_logged_in() ) {
            return;
        }
        if ( ! bp_is_group() ) {
            return;
        }
        
    /*Extra code to find term_id and category_link*/
    
        $category_link = get_category_link($termid['term_id']);
        buddypress()->bp_options_nav[ $current_group_slug ][] = array(
            'name' => 'Posts',
            'link' => $category_link,
            'slug' => 'posts',
            'css_id' => 'posts',
            'position' => 9999999, // last
            'user_has_access' => true,
        );
    }
    add_action( 'bp_setup_nav', 'add_posts_category_to_group_nav', 100 );

    The question is how I will manage to show the output of custom link not to its page but under group info like the other menus of group navigation. For example “Members” option shows members of the group under the cover page and navagation menu of the group. Members as shown in the same page as group.

    How can this be done in KLEO with custom link which is a wordpress page (/category/custom_slug)??

    Thank you!

    Andreas

    #96217
     Andrei
    Moderator

    Hi,

    Unfortunately this is a much more complex task and will require advanced knowledge about the way the buddypress components work. If you are a developer I recommend you to do a research about the buddypress user and group navigations and screens.

    Cheers

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution
    #144101
     pandreas82
    Participant

    I just noticed that bp_options_nav has been deprecated since version 2.6 of buddypress (https://buddypress.trac.wordpress.org/changeset/10745).

    Can anyone explain to me the required changes to this specific code?

    Thank you!

    Regards,

    Andreas

Viewing 3 posts - 1 through 3 (of 3 total)

The forum ‘KLEO’ is closed to new topics and replies.

Log in with your credentials

Forgot your details?