Last active
May 30, 2019 12:31
-
-
Save KaineLabs/3adcac73a81cf45ce6624cc8a6bec810 to your computer and use it in GitHub Desktop.
Remove Xprofile Fields Group.
This file contains hidden or 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 Xprofile Fields Group. | |
*/ | |
function yzc_remove_edit_profile_settings_page() { | |
// Get List Of Forbidden Groups. | |
$forbidden_groups = array( 1 ); | |
if ( bp_is_current_component( 'xprofile' ) && bp_current_action() == 'edit' && in_array( bp_action_variable( 1 ), $forbidden_groups ) ) { | |
bp_core_remove_subnav_item( bp_get_profile_slug(), 'edit' ); | |
} | |
} | |
add_action( 'bp_actions', 'yzc_remove_edit_profile_settings_page', 20 ); | |
function yzc_hide_profile_settings_xprofile_fields_group( $groups ) { | |
if ( bp_is_register_page() ) { | |
return $groups; | |
} | |
// Get List Of Forbidden Groups. | |
$forbidden_groups = array( 1 ); | |
foreach ( $groups as $key => $group ) { | |
if ( in_array( $group->id, $forbidden_groups ) ) { | |
unset( $groups[ $key ] ); | |
} | |
} | |
return $groups; | |
} | |
add_filter( 'bp_xprofile_get_groups', 'yzc_hide_profile_settings_xprofile_fields_group' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment