Skip to:
Content
Pages
Categories
Search
Top
Bottom

Reply To: Undefined index: position in Buddybar

@ch1n3s3b0y

Participant

This is what I changed in functions.php. It was do to with adding subnav items, removing subnav items and renaming some of them:

/* BP Add subnavigation on profile */

add_action('bp_setup_nav', 'bp_profile_submenu_profile' );
function bp_profile_submenu_profile() {
	global $bp;
	if(!is_user_logged_in()) return '';
	bp_core_new_subnav_item( array( 
		'name' => 'Seminar Bookings',
		'slug' => 'seminar-bookings', 
		'parent_url' => $bp->loggedin_user->domain . $bp->bp_nav['profile']['slug'] . '/' ,
		'parent_slug' => $bp->bp_nav['profile']['slug'],
		'position' => 20,
		'screen_function' => 'seminar_bookings'
		) 
	); 
}
function seminar_bookings() {
    add_action( 'bp_template_content', 'seminar_bookings_screen' );
    bp_core_load_template( apply_filters( 'bp_core_template_plugin', 'members/single/plugins' ) );
}

function seminar_bookings_screen() { 
    locate_template( array( 'buddypress/members/single/profile/seminar-bookings.php' ), true );
}

/* BP Remove unneeded subnav items */
function remove_bp_subnav_items() {
	global $bp;
	bp_core_remove_subnav_item('profile','change-avatar');
	bp_core_remove_subnav_item('profile','change-cover-image');
}

add_action( 'bp_setup_nav', 'remove_bp_subnav_items');

/* BP Rename subnav items */
function rename_bp_subnav_items(){
	global $bp;
	$bp->bp_options_nav['profile']['edit']['name'] = 'Edit Profile';
	$bp->bp_options_nav['profile']['public']['name'] = 'View Profile';
}
add_action('bp_setup_nav', 'rename_bp_subnav_items', 201);

The only time I had mentioned ‘position’ was when setting up a new subnav item.

Skip to toolbar