Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save toluaddy/e0a9ccd0d1823d07320cffb7a5eafb44 to your computer and use it in GitHub Desktop.
Save toluaddy/e0a9ccd0d1823d07320cffb7a5eafb44 to your computer and use it in GitHub Desktop.
BuddyPress - make edit screen the default for own profile
<?php
add_action( 'bp_setup_nav', 'jmw_make_edit_default_for_own_bp_profile', 15 );
/*
* Edit the buddypress menus
*/
function jmw_make_edit_default_for_own_bp_profile() {
global $bp;
if ( ! bp_is_my_profile() ) {
return ;
}
// Change name of Profile tab to Edit Profile
$bp->bp_nav['profile']['name'] = 'Edit Profile';
// Make the Profile sub nav default item = Edit
bp_core_new_nav_default(
array(
'parent_slug' => 'profile',
'subnav_slug' => 'profile/edit',
'screen_function' => 'xprofile_screen_edit_profile'
)
);
// Some magic that BuddyDev told me to add in to make it work
add_action('bp_screens', 'bp_members_screen_display_profile', 3 );
// Remove the View sub nav item
bp_core_remove_subnav_item( 'profile', 'public' );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment