0

I want to add some pages/tabs to the user's buddypress profile.

I'm using the following function to get at least one page working:

function my_bp_nav_adder() {
    global $bp;
    bp_core_new_nav_item(
            array(
                    'name'                => __( 'Listings', 'buddypress' ),
                    'slug'                => 'my-listings',
                    'position'            => 1,
                    'screen_function'     => 'listingsdisplay',
                    'default_subnav_slug' => 'my-listings',
                    'parent_url'          => $bp->loggedin_user->domain . $bp->slug . '/',
                    'parent_slug'         => $bp->slug
            ) );
}

function listingsdisplay() {
    //add title and content here - last is to call the members plugin.php template
    add_action( 'bp_template_title', 'my_groups_page_function_to_show_screen_title' );
    add_action( 'bp_template_content', 'my_groups_page_function_to_show_screen_content' );
    bp_core_load_template( apply_filters( 'bp_core_template_plugin', 'members/single/plugins' ) );
}

function my_groups_page_function_to_show_screen_title() {
    echo 'My new Page Title';
}

function my_groups_page_function_to_show_screen_content() {
    echo 'My Tab content here';

}

add_action( 'bp_setup_nav', 'my_bp_nav_adder', 50 );

(found here)

But if I rename my-listings, I get a "404 page not found". I would like to have this called "Bookmarks"

And how can I create more pages and menu tab items by using this function?

closed as off-topic by Howdy_McGee, Mark Kaplun, TheDeadMedic, Robert hue, Mayeenul Islam Sep 21 '15 at 9:25

This question appears to be off-topic. The users who voted to close gave this specific reason:

If this question can be reworded to fit the rules in the help center, please edit the question.

0

Try changing:

'parent_url'    => $bp->loggedin_user->domain . $bp->slug . '/',
'parent_slug'   => $bp->slug

to:

'parent_url'    => $bp->displayed_user->domain,
'parent_slug'   => $bp->profile->slug,

If you add another nav item, be sure to adjust all the fields and add new functions to handle the display.

Not the answer you're looking for? Browse other questions tagged or ask your own question.