BuddyDev

Search

[Resolved] Buddypress: Add a subnav item to members Profile – Friends

  • Participant
    Level: Initiated
    Posts: 3
    Chris on #3976

    Hi,

    How can I add a subnav “invite friends” to the members profile – Friends – next to the Requests subnav? When a member clicks on the “invite friends” tab, it takes them to the members page. However the “invite friends” must not display when viewing another member’s Profile – friends.

    Thanks in advance 🙂

  • Keymaster
    (BuddyDev Team)
    Posts: 24623
    Brajesh Singh on #3980

    Hi Chris,
    Welcome to BuddyDev forums.

    You can use the following code in your bp-custom.php to do that

    
    
    function buddydev_setup_dummy_nav() {
    
        $friends_slug = bp_get_friends_slug();
    
        bp_core_new_subnav_item( array(
            'name'          => 'Invite',
            'slug'          => 'do-invite',
            'parent_slug'   => $friends_slug,
            'parent_url'    => trailingslashit( bp_loggedin_user_domain() . $friends_slug )  ,
            'link'          => get_permalink( buddypress()->pages->members->id ), //where the Link should pint to for this sub nav?
            'screen_function' => function () {}
        ));
    }
    
    add_action( 'bp_setup_nav', 'buddydev_setup_dummy_nav' );
    
    

    Hope it helps.

    Regards
    Brajesh

  • Keymaster
    (BuddyDev Team)
    Posts: 24623
    Brajesh Singh on #4040

    Hi Chris,
    Can you please check and let me know?

    Thank you
    Brajesh

  • Participant
    Level: Initiated
    Posts: 3
    Chris on #4201

    Hi, sorry for not replying sooner.

    I tried the code above and it is giving me

    “Parse error: syntax error, unexpected ‘function’ (T_FUNCTION) in /home…” error

    uncertain if I am supposed to replace anything. Complete newbie in PHP.

    Thanks for the help.

  • Keymaster
    Level: Yogi
    (BuddyDev Team)
    Posts: 3115
    Ravi on #4203

    Hi Chris,

    Brajesh sir is away. So I am posting here. Could you please tell me know the whole error you are getting with your code You are using in bp-custom.php.

    Thank You
    Ravi

  • Participant
    Level: Initiated
    Posts: 3
    Chris on #4204

    never mind it is working, the error was due to another snippet of php code. Thank you guys so much for all the help

  • Keymaster
    Level: Yogi
    (BuddyDev Team)
    Posts: 3115
    Ravi on #4205

    Hi Chris,

    Thank You for the acknowledgement. I am glad the issue is resolved.

    Thank You
    Ravi

You must be logged in to reply to this topic.

This topic is: resolved