Undefined index: position in Buddybar
-
Hi
I am getting this error when debugging is on:
Notice: Undefined index: position in C:\xampp\thewebsite\wp-content\plugins\buddypress\bp-core\bp-core-buddybar.php on line 698
I have created some new subnav items as well as removing others. I’m assuming this is saying that there is no subnav item ‘position’ value?
-
This is most probably a result of your code (or a plugin you’re using) referring to a position array key, which isn’t defined.
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.
Position is actually optional so if you wanted to avoid investigating what exactly is going on here you could just remove it altogether
- The topic ‘Undefined index: position in Buddybar’ is closed to new replies.