Skip to:
Content
Pages
Categories
Search
Top
Bottom

Re: bp_core_new_nav_item() not working to create new navigation item under “my profile” tab

@shanebp

Moderator

That error is due to the missing $bp global.

>So I’m trying to add a new navigation under the “my profile” tab

Do you mean in the admin bar at the top?
Or on profile pages under ‘Profile’ in the ‘Activity Profile Messages’ etc nav ?

if it’s the latter, you want to a subnav item, not a nav item.
Try this (which assumes you don’t know about the other functions needed) :

`

add_action( ‘bp_setup_nav’, ‘add_feedback_subnav_tab’, 100 );
function add_feedback_subnav_tab() {
global $bp;
bp_core_new_subnav_item( array(
‘name’ => ‘Feedback’,
‘slug’ => ‘feedback’,
‘parent_url’ => trailingslashit( bp_loggedin_user_domain() . ‘profile’ ),
‘parent_slug’ => ‘profile’,
‘screen_function’ => ‘profile_screen_feedback’,
‘position’ => 50
)
);
}

// show feedback when ‘Feedback’ tab is clicked
function profile_screen_feedback() {
add_action( ‘bp_template_content’, ‘profile_screen_feedback_show’ );
bp_core_load_template( apply_filters( ‘bp_core_template_plugin’, ‘members/single/plugins’ ) );
}

function profile_screen_feedback_show() {
echo “Feedback Screen”;

// call your feedback template
//locate_template( array( ‘feedback-profile.php’ ), true );

}

`

Skip to toolbar