Forked from calliaweb/jmw_make_edit_default_for_own_bp_profile.php
Created
February 3, 2020 16:53
-
-
Save toluaddy/e0a9ccd0d1823d07320cffb7a5eafb44 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