Created
February 16, 2017 18:19
-
-
Save calliaweb/592a34fcc94a4a0b5757b50f6f9142ba to your computer and use it in GitHub Desktop.
BuddyPress - make edit screen the default for own profile
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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