BuddyDev

Search

[Resolved] Buddypress Profile order Tab

Tagged: , ,

  • Participant
    Level: Enlightened
    Posts: 39
    Tiziano on #11505

    Hello, I’ve tried to reord profile’s tabs using this code inside functions.php as described in this post: https://buddypress.org/support/topic/re-order-profile-menu-items/
    the code is:

    function my_change_profile_tab_order() {
    global $bp;

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

    I could even test it because the same code appeared at the top of the website so I immediatly removed it.

    So: can you suggest me please to code to use to move “blogs” tab at the beginning?

    Thanks
    Tiziano

  • Participant
    Level: Enlightened
    Posts: 39
    Tiziano on #11554

    Hello?Is there anybody can help me with this? 🙂

    • This reply was modified 6 years, 4 months ago by Tiziano.
  • Keymaster
    Level: Yogi
    (BuddyDev Team)
    Posts: 2909
    Ravi on #11564

    Hello Tiziano,

    If you want to move blog menu at the beginning. Just modify ‘buddyblog-loader.php’ Find ‘$main_nav’ might be at line no. 102 and replace position number with the number less than 10. It will render blog menu at the beginning. Please let me know if it works or not

    Thank You
    Ravi

  • Participant
    Level: Enlightened
    Posts: 39
    Tiziano on #11566

    Hello Ravi,

    thanks for your reply. Unfortunally I don’t use buddyblog plugin. I think I need to find in buddypress the string that you’re talkin about. Could you suggest me please the file to modify?

    Thank you

    Tiziano

  • Keymaster
    Level: Yogi
    (BuddyDev Team)
    Posts: 2909
    Ravi on #11567

    Hello Tiziano,

    Sorry for not getting your point. Because you are talking about “blogs” tab. I thought you was talking about BuddyBlog. And, it is not a good idea to change in BuddyPress plugin file. but you can use “BuddyPress Reorder Tabs” plugin by BuddyBoss to accomplish your feature. Hope it will resolve your problem.

    Regards
    Ravi

    • This reply was modified 6 years, 4 months ago by Ravi.
  • Participant
    Level: Enlightened
    Posts: 39
    Tiziano on #11570

    Hi Ravi, thanks for your support. I used for weeks buddypress reorder tabs plugin but at least I’ve deactivated it for two reasos:
    1. It didn’t work properly on my website (maybe a compatibility issue with another plugin)
    2. Too much plugin already installed

    That’s why I’m looking for a “code” solution…

    Thanks…
    Tizinao

  • Participant
    Level: Enlightened
    Posts: 39
    Tiziano on #11632

    Hello Ravi! Any suggestion about the code?
    Thanks!
    Tiziano

  • Keymaster
    (BuddyDev Team)
    Posts: 24149
    Brajesh Singh on #11636

    Hi Tiziano,
    Ravi has asked me to assist you on this as his hands are full. I will find some time in the day and assist you with the code.

    Thank you
    Brajesh

  • Keymaster
    (BuddyDev Team)
    Posts: 24149
    Brajesh Singh on #11660

    Hi Tiziano,
    Thank you for the patience.

    Please remove your code snippet that you are already using.

    Then, please put this in your bp-custom.php

    
    
    /**
     * Reorder BuddyPress profile tabs/navigation.
     */
    function buddydev_reorder_buddypress_profile_tabs() {
    	$bp  = buddypress();
    	$nav = $bp->members->nav;
    
    	// it's a map of nav items for user profile to their position.
    	$nav_items = array(
    		'settings' => 10,
    		'activity' => 20,
    		'friends'  => 30,
    		'groups'   => 40,
    		'blogs'    => 50,
    		'messages' => 60,
    		'profile'  => 70,
    	);
    
    	foreach ( $nav_items as $nav_item => $position ) {
    		$nav->edit_nav( array( 'position' => $position ), $nav_item );
    	}
    }
    add_action( 'bp_setup_nav', 'buddydev_reorder_buddypress_profile_tabs', 999 );
    
    

    That will do it for you.

    Hope that helps.

    Regards
    Brajesh

  • Participant
    Level: Enlightened
    Posts: 39
    Tiziano on #11667

    Dear Brajesh, thank you so much for your help. I’ve tried to use your code on bp-custom.php but the result was this: https://edizioniopen.it/wp-content/uploads/2017/11/Schermata-2017-11-11-alle-15.55.00.png

    As you can see, the code appears at the top of the website… 🙁

    What can we do?
    Thanks!
    Tiziano

The topic ‘ [Resolved] Buddypress Profile order Tab’ is closed to new replies.

This topic is: resolved