Skip to:
Content
Pages
Categories
Search
Top
Bottom

customizing buddypress profile page default tab and item-nav order

  • Avatar of lwaltzer
    lwaltzer
    Participant

    @lwaltzer

    With the assistance of @boonebgorges, I was able change both the default tab that loads when you visit a BuddyPress profile page and the order of the tabs on profile pages.

    Both of these functions are called before theme files are, which was giving me trouble. Here’s how to do it:

    Default Tab:
    In your wp-config file, add the following line:

    define( ‘BP_DEFAULT_COMPONENT’, ‘preferred_default_tab’ );

    but make sure it’s above the require_once(ABSPATH . ‘wp-settings.php’); line, or else the change won’t take place.

    Item-Nav Order
    In plugins/bp-custom.php, I added

    function bbg_change_profile_tab_order() {
    global $bp;

    $bp->bp_nav = 10;
    $bp->bp_nav = 20;
    $bp->bp_nav = 30;
    $bp->bp_nav = 40;
    $bp->bp_nav = 50;
    $bp->bp_nav = 60;
    $bp->bp_nav = 70;
    }
    add_action( ‘bp_setup_nav’, ‘bbg_change_profile_tab_order’, 999 );

    and was able to order the tabs as I wanted. Thanks, Boone!

Viewing 25 replies - 1 through 25 (of 25 total)
  • Avatar of Roger Coathup
    Roger Coathup
    Participant

    @rogercoathup

    Thanks for posting… that’s an excellent quick lookup for something I have on a project todo list

    Avatar of Roger Coathup
    Roger Coathup
    Participant

    @rogercoathup

    I added these functions as described, but neither had any effect in my theme. Is there something else missing?

    Avatar of Hugo
    Hugo
    Moderator

    @hnla

    Doesn’t look to be. You followed the steps above exactly?

    I’m not sure why the Constant is required and that for me just causes the profile link to fail to load, the function however works as described.

    Did you copy and paste the code directly from this page?

    Avatar of Roger Coathup
    Roger Coathup
    Participant

    @rogercoathup

    Ok… I cut and pasted the code, and that had introduced some control characters that messed everything up.

    However, the routine to change the tab order is not working for me… I went for the following:

    function ka_change_profile_tab_order() {
    global $bp;

    $bp->bp_nav = 10;
    $bp->bp_nav = 20;
    $bp->bp_nav = 30;
    $bp->bp_nav = 50;
    $bp->bp_nav = 60;
    $bp->bp_nav = 70;
    }

    add_action( ‘bp_setup_nav’, ‘ka_change_profile_tab_order’, 999 );

    But, that results in some strange markup being created:

    A new tab is displayed at the start with no content -
    [li id="-personal-li"]
    [a id="user-" href][/a]
    [/li]

    and the profile and messages tabs are not in the right order. I get the following rendered:

    nonsense (see above) – messages – profile – activity – groups – following – settings

    Avatar of Roger Coathup
    Roger Coathup
    Participant

    @rogercoathup

    p.s. @hnla yes, the default component constant also failed to load the profile for me. So, I’ve removed that

    Avatar of rich! @ etiviti
    rich! @ etiviti
    Participant

    @nuprn1

    just tested and it works for me – but when copy/pasting from this site you get curly quotes, make sure to replace those.

    Avatar of Roger Coathup
    Roger Coathup
    Participant

    @rogercoathup

    The profile tab is breaking it for me. If I remove that tab from my function, I no longer get the nonsense code generated. Note: I still get a profile tab inserted (I assume from the bp-core), even though it is no longer in my function (unfortunately, it is in the wrong place).

    p.s. yes, I replaced the quotes

    Avatar of Roger Coathup
    Roger Coathup
    Participant

    @rogercoathup

    @nuprn1 @hnla – Ok, I’ve found the problem, or perhaps the bug in BP (I suspect this belongs in the trac)… OR, perhaps this is correct behaviour??

    We’d renamed the XPROFILE_SLUG:

    define(‘BP_XPROFILE_SLUG’, ‘account’);

    If I remove this definition, the routine to setup the nav works fine.

    Or, if I use $bp->bp_nav = 20; instead of $bp->bp_nav = 20; it works fine.

    I guess bp_core isn’t taking into account changes to the xprofile slug, and that is stopping re-assignments of the nav order for the ‘profile’ tab from working

    Avatar of nickmy
    nickmy
    Participant

    @nickmy

    Hello

    can someone tell me how I can just remove a created Profile Category? I want to use it somewhere else and not unter the profile tab.

    I’ve created a new category with fields in the Profile Field Setup and now I dont want to have it under the profile. Please I’m notgood with php. Just a special category not all of them

    Avatar of rich! @ etiviti
    rich! @ etiviti
    Participant

    @nuprn1

    correct behavior – the slug is used as the nav id

    $bp->profile->slug = BP_XPROFILE_SLUG;

    /* Add ‘Profile’ to the main navigation */
    bp_core_new_nav_item( array( ‘name’ => __( ‘Profile’, ‘buddypress’ ), ‘slug’ => $bp->profile->slug, ‘position’ => 20, ‘screen_function’ => ‘xprofile_screen_display_profile’, ‘default_subnav_slug’ => ‘public’, ‘item_css_id’ => $bp->profile->id ) );

    Avatar of Hugo
    Hugo
    Moderator

    @hnla

    @nickmy please don’t hijack threads it’s makes for confusion. Please start a fresh topic on your issue/requirement.

    Avatar of Hugo
    Hugo
    Moderator

    @hnla

    @nuprn1 have you any notion of why the constant definition causes an issue? or indeed why it’s required?

    Avatar of Roger Coathup
    Roger Coathup
    Participant

    @rogercoathup

    @hnla, @nuprn1

    The constant is supposed to set the default tab that is active when you visit a profile.

    In my case, although I’ve made activity the 3rd tab, it is still the default active one when I visit the profile.

    Defining BP_DEFAULT_COMPONENT in wp_config.php is now working for me – provided I use my new slug (‘account’) instead of ‘profile’. Also, as @nuprn1 points out – it won’t work if you cut and paste the code from this thread (because the quotes are mangled).

    Thanks for the help on this guys. Much appreciated.

    Avatar of Hugo
    Hugo
    Moderator

    @hnla

    Yes I’m aware of the issue with incorrect back ticks for quotes as It’s arisen all too often recently and why I asked whether you had copy and pasted; still, doesn’t explain why the Constant didn’t work for me , will have to look again. yep me being dumb :)

    Avatar of erikshosting
    erikshosting
    Member

    @erikshosting

    What about ? have you had any luck modifying that? it doesnt seem to respond to the same syntax as all the other tabs..

    Avatar of marcycapron
    marcycapron
    Participant

    @marcycapron

    I have no luck in changing the default to profile… despite having never changed the slug… I can change the order just fine, but the second I put the snippet in wp-config the base user profile (which default goes to activity) doesn’t work and goes to home page.

    crap.

    Avatar of justbishop
    justbishop
    Member

    @justbishop

    @marcycapron, did you ever figure it out? I need to do the same thing you were after (changing the default screen that loads when a member name is clicked on to “Profile”).

    Nice, works fine for me. Using this in ‘/wp-content/plugins/bp-custom.php’:

    `define(‘BP_DEFAULT_COMPONENT’,’profile’);`

    Avatar of ColdManager
    ColdManager
    Member

    @coldmanager

    Hey , i done this way and now when i go to the other member’s page it will show only profile detail with no other tab (personal,friends,groups,favorite, mentions) but for me its ok. But after i tried checking system, i found that some notification issues, like friendship , the notification will gone when click it , but right now the notification process can’t be done because we can’t go to his personal page anymore , any suggestion?

    Avatar of cwheelsone
    cwheelsone
    Participant

    @cwheelsone

    Found solution on my buddypress site – This drove me crazy :) .. My clients wanted ‘Profile’ to show first when their link was clicked on. OK, makes sense for this site.
    1. Did not work: This method broke my buddydress theme in IE (but not Mozilla) – adding ‘define(‘BP_DEFAULT_COMPONENT’,’profile’); ‘ to bp-custom.php and uploading it to /wp-content/plugins. .. useless for me.
    2. Worked – adding ‘define(‘BP_DEFAULT_COMPONENT’,’profile’);’ to my wp-config.php file (up top, above – ‘// ** MySQL settings – You can get this info from your web host ** //’) – UREEKA BABY!!
    I’m using buddypress 1.2.7 , buddydress themes and wordpress 3.0.4 – Hope this helps someone..

    Avatar of mutualdesigns
    MutualDesigns
    Member

    @mutualdesigns

    Is there a way to add a class or title to a menu item on the profile or groups page?

    Avatar of Sean Infinitee
    Sean Infinitee
    Participant

    @sean-infinitee

    Hey guys-hoping you can help me figure out what I’m doing wrong…if I can’t hide or remove the “community” tab then it would seem to be a pretty simple concept to change the order of the tab, but no luck with the above…not that php or css savvy but the instructions here are pretty straightforward so any help is appreciated!

    Using latest wordpress version and just installed buddypress yesterday so I would assume it is also the latest version.

    My website is http://www.defendersofturntablism.org

    I added the line `define( ‘BP_DEFAULT_COMPONENT’, ‘preferred_default_tab’ ); to wp-config.php above ‘//MySQL settings – You can get this info from your web host **//`

    Created bp-custom.php in plugins folder and added

    `function bbg_change_profile_tab_order() {
    global $bp;

    $bp->bp_nav = 10;
    $bp->bp_nav = 20;
    $bp->bp_nav = 30;
    $bp->bp_nav = 40;
    }
    add_action( ‘bp_setup_nav’, ‘bbg_change_profile_tab_order’, 999 );`

    Unfortunately all this has done is add the above line of code to the header of my site…can anyone help me figure this out??! Seems like it should be very simple. Ideally I want to have see the community tab go away and have the members section contain the buddypress activity, groups, forums, etc.

    Thanks in advance!!

    Avatar of dylancasey
    dylancasey
    Participant

    @dylancasey

    Sean,

    I have a very similar question to yours — I’m trying to modify the order of the tabs in the Groups navigation, rename some of them, and get rid of some of them. I, too, am running BP 1.6.1.

    I can help in one respect — you need to enclose the code in your bp-custom.php file in the php brackets:
    <?php

    YOUR CODE

    ?>

    In the meantime, I would appreciate (from anyone) help with these customizations of the BP menus. Did something change in 1.6 to affect this? Much of the help out there concerns v1.5.

    Thanks in advance,
    Dylan

    Avatar of @modemlooper
    @modemlooper
    Moderator

    @modemlooper

    Use
    `$bp->bp_options_nav = ’30′;
    $bp->bp_options_nav = false;`

    Avatar of Intervik
    Intervik
    Participant

    @intervik

    buddypress 2012 change nav order members menu and submenu. No fuzz and works in buddypress 6.1 version. Thanks !
    $bp->bp_nav = ’10′;
    $bp->bp_options_nav = ’30′;
    $bp->bp_options_nav = false;

Viewing 25 replies - 1 through 25 (of 25 total)

You must be logged in to reply to this topic.