Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save KaineLabs/3adcac73a81cf45ce6624cc8a6bec810 to your computer and use it in GitHub Desktop.
Save KaineLabs/3adcac73a81cf45ce6624cc8a6bec810 to your computer and use it in GitHub Desktop.
Remove Xprofile Fields Group.
<?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