Skip to:
Content
Pages
Categories
Search
Top
Bottom

Displayed user user-nicename in profile activity tab name


  • Kir 2012
    Participant

    @kir-2012

    Hi how would I change the name of the buddypress activity tab to include the name of the displayed user? Just the activity tab, I have this code below:

    ////////////////////////////////////CHANGE MENU NAMES / POSITIONS //////////////////////////////
    function mb_profile_menu_tabs(){
    global $bp;
    //$bp->bp_nav['activity']['position'] = 14;
    $bp->bp_nav['activity']['name'] = 'Feed';
    }
    add_action('bp_setup_nav', 'mb_profile_menu_tabs', 201);
    //////////////////////////////////// CODE END ///////////////////////////////////////////////////
    

    The above code in functions changes the tab name to Feed but I’m trying to work out how to make the tab name: ‘displayed username’s Feed’

    Has anyone had to do this before / got any pointers? I’d be so grateful, I’ve researched and tried various things but can’t seem to get it working

    Thank you 🙂

Viewing 1 replies (of 1 total)
  • That’s pretty old code you’ve found. We have a new API for that:

    Navigation API

    The example “Changing the name of the Unread subnav item of the user’s Notifications nav menu” is pretty close to what you’re looking for. If you want to add the displayed user’s display name, this is close:

    function bpcodex_change_activity_nav_name() {
    
    var_dump( buddypress()->members->nav );
        buddypress()->members->nav->edit_nav( array(
            'name' => bp_get_displayed_user_fullname() . "'s Feed",
        ), 'activity' );
    }
    add_action( 'bp_setup_nav', 'bpcodex_change_activity_nav_name', 100 );

    You’ll need to add that code to your bp-custom.php file or similar. https://codex.buddypress.org/themes/bp-custom-php/

Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.
Skip to toolbar