Skip to content

Instantly share code, notes, and snippets.

@toluaddy
Forked from imath/bp-custom.php
Created February 3, 2020 17:05
Show Gist options
  • Save toluaddy/c1d341f020bec0e0eb98b1b027b65b55 to your computer and use it in GitHub Desktop.
Save toluaddy/c1d341f020bec0e0eb98b1b027b65b55 to your computer and use it in GitHub Desktop.
Edit BuddyPress primary nav so that profile primary item is before the activity primary item
<?php
/**
* BuddyPress 2.6.0 introduced a new nav API
* with a Backcompat mechanism. But accessing/editing
* deprecated globals can lead to such problems...
*
* It's too bad Theme designers forget to test betas :)
*/
function strothi_profile_primary_nav_first() {
buddypress()->members->nav->edit_nav( array(
'position' => 6,
), 'profile' );
}
add_action( 'bp_xprofile_setup_nav', 'strothi_profile_primary_nav_first' );
// You'll probably need to also have the profile defined as default component..
function strothi_profile_as_front_page() {
if ( defined( 'BP_DEFAULT_COMPONENT' ) ) {
return;
}
define( 'BP_DEFAULT_COMPONENT', 'profile' );
}
add_action( 'bp_init', 'strothi_profile_as_front_page', 5 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment