Reordering Buddy Press profile navigation

I am using this code to reorder the positions of the menu items for BuddyPress profile. I am using the xprofile (not sure if that makes a difference). Here is the code that I am trying to use:

<?php
/*
Plugin name: BP custom
Plugin URI: http://pittbullweb.com
Description: Customs for Buddy Press
Version: 0.1
Author URI: http://pittbullweb.com
*/

function bbg_change_profile_tab_order() {
global $bp;

    $bp->bp_nav['profile']['position'] = 10;
    $bp->bp_nav['activity']['position'] = 20;
    $bp->bp_nav['blogs']['position'] = 30;
    $bp->bp_nav['friends']['position'] = 40;
    $bp->bp_nav['messages']['position'] = 50;
    $bp->bp_nav['groups']['position'] = 60;
    $bp->bp_nav['settings']['position'] = 70;
}
add_action('bp_setup_nav', 'bbg_change_profile_tab_order', 999 );
?>

I am going by the instructions given here to be able to do this. However when I go to activate the plugin i get a fatal error:

Read More

Fatal error: Cannot redeclare bbg_change_profile_tab_order() (previously declared in /var/www/vhosts/giftcardswapping.com/demo/wp-content/plugins/bp-custom.php:11) in /var/www/vhosts/giftcardswapping.com/demo/wp-content/plugins/bp-custom.php on line 20

I have also tried renaming the function as well and still receive the same fatal error.

I do not understand how it is redeclared anywhere. I would appreciate any help to figure this out. Thank you.

Related posts

Leave a Reply

2 comments

  1. It looks like you have the function both in bp-custom.php and in your plugin.

    You don’t need a plugin.

    Put your code in plugins/bp-custom.php only.

    Or in your-theme/functions.php

  2. An easy approach would be to rename your function, this way you won’t be re-declaring an already existing function.

    Try changing bbg_change_profile_tab_order to my_bbg_change_profile_tab_order