Last active
August 21, 2018 03:07
-
-
Save KaineLabs/8f4ea287eda7ec3ca991249cd71bdd73 to your computer and use it in GitHub Desktop.
Remove Profile Info Settings Page And Set Edit as Default Page !
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 | |
/** | |
* Remove Profile info Page. | |
*/ | |
function yzc_remove_edit_profile_settings_page() { | |
bp_core_remove_subnav_item( bp_get_profile_slug(), 'profile-info' ); | |
} | |
add_action( 'bp_actions', 'yzc_remove_edit_profile_settings_page', 20 ); | |
/** | |
* Set Edit Page as Default page. | |
*/ | |
function yzc_set_edit_page_as_default() { | |
if ( ! bp_is_my_profile() ) { | |
return ; | |
} | |
bp_core_new_nav_default ( | |
array( | |
'parent_slug' => 'profile', | |
'subnav_slug' => 'edit', | |
'screen_function' => 'yz_get_profile_settings_page' | |
) | |
); | |
} | |
add_action( 'bp_actions', 'yzc_set_edit_page_as_default', 150 ); | |
/** | |
* Redirect Default Tab to edit page | |
*/ | |
function yzc_custom_default_redirect_profile_group () { | |
if ( bp_current_component() == 'profile' && bp_current_action() == 'edit' && ! bp_action_variable( 1 ) ) { | |
bp_core_redirect( trailingslashit( bp_displayed_user_domain() . bp_get_profile_slug() . '/edit/group/1' ) ); | |
} | |
} | |
add_action( 'bp_screens', 'yzc_custom_default_redirect_profile_group', 2 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment