Skip to:
Content
Pages
Categories
Search
Top
Bottom

Rename Group Nav Not Working


  • Tara Claeys
    Participant

    @taraclaeys

    Several years ago I used code I found here to rename the “Home” nav item on the Groups page. I used this code in my Theme functions.php file.
    It has been working fine for about 4 years, but now when I go to create a new group, I get an error message
    screenshot: https://share.getcloudapp.com/d5ub6x2p

    Below is the code I am using. I assume something changed in an update so perhaps bp_current_item is not working anymore? Or edit_nav?

    //* Rename “Home” to “Reflections”of menu item in BuddyPress Group
    // buddypress()->bp_options_nav[buddypress()->groups->current_group->slug][‘home’][‘name’] = ‘Home/Reflections’;
    buddypress()->groups->nav->edit_nav( array( ‘name’ => __( ‘Home/Reflections’, ‘buddypress’ ) ), ‘home’, bp_current_item() );

    }

Viewing 1 replies (of 1 total)

  • David Cavins
    Keymaster

    @dcavins

    On what hook are you firing that function? Are you using the Legacy or Nouveau template pack? (Have you changed from the Legacy to Nouveau template pack recently?)

    It could be a number of things, but my first thought is that there’s no reason to be changing the groups nav when you’re in the middle of the create routine, so maybe there’s a more strict check we should be using above and beyond the bp_is_group() check as used on the API page: https://codex.buddypress.org/developer/navigation-api/#change-item-names-of-users-and-groups-nav-menus

    In any case, you should be able to prevent the error by adding a conditional around calling edit_nav():

    $bp = buddypress();
    if ( isset( $bp->groups->nav ) ) {
    	$bp->groups->nav->edit_nav( array( 'name' => __( 'Home/Reflections', 'buddypress' ) ), 'home', bp_current_item() );
    }
Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.
Skip to toolbar