-
-
Save imath/113ad3226c9a01ac56c2d2edabb458f3 to your computer and use it in GitHub Desktop.
Set the Edit xProfile Subnav as the default one for self users xProfile nav.
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 | |
// Exit if accessed directly | |
defined( 'ABSPATH' ) || exit; | |
function eloyruiz_edit_view_as_default_subnav() { | |
$bp = buddypress(); | |
// Make sure other users than the current one will get the public view | |
if ( ! bp_is_my_profile() ) { | |
return; | |
} | |
// Edit the main nav to use the Edit subnav as default. | |
$bp->members->nav->edit_nav( array( | |
'link' => sprintf( '%1$s%2$s%3$s', | |
trailingslashit( bp_loggedin_user_domain() ), | |
trailingslashit( bp_get_profile_slug() ), | |
'edit' | |
), | |
'screen_function' => 'xprofile_screen_edit_profile', | |
'default_subnav_slug' => 'edit', | |
), 'profile' ); | |
// Remove the public nav. | |
$bp->members->nav->delete_nav( 'public', 'profile' ); | |
} | |
add_action( 'bp_xprofile_setup_nav', 'eloyruiz_edit_view_as_default_subnav' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment