Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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