– Single profile page. From show tab and from EDIT tab (see snippet)
– From dashboard profile edit page: not possible – normally BP users shouldn’t have access to profile dashboard. They can manage their profile from front-end.
– From custom profile fields. (see snippet)
– From tabs every where. (see snippet)
Almost any described areas, as example
function bpfr_hide_profile_edit( $retval ) {
// remove field from edit tab
if( bp_is_profile_edit() ) {
$retval['exclude_fields'] = '54'; // ID's separated by comma
}
// allow field on register page
if ( bp_is_register_page() ) {
$retval['include_fields'] = '54'; // ID's separated by comma
}
// hide the field on profile view tab
if ( $data = bp_get_profile_field_data( 'field=54' ) ) :
$retval['exclude_fields'] = '54'; // ID's separated by comma
endif;
return $retval;
}
add_filter( 'bp_after_has_profile_parse_args', 'bpfr_hide_profile_edit' );
Thank you very much!
But here what I got.
Fatal error: Uncaught Error: Call to undefined function bp_is_user_edit() in wp-content/plugins/player-info-collector/player-info-collector.php on line 293
I have fund this code
function bp_is_profile_edit() {
_deprecated_function( __FUNCTION__, ‘1.5’, ‘bp_is_user_profile_edit()’ );
return bp_is_user_profile_edit();
}
But bp_is_user_profile_edit seems doesnt work at all.
Sorry for the outdated trick.
bp_is_profile_edit
is deprecated in favor of bp_is_user_profile_edit.
Check for the outdated fn in the plugin mentionned in the error msg.
In case of, here a tutorial with more options.
But how to hide the tab, right now it works. But it show the tab – group of fields which I want to hide. SO when user click on the tab, there is no fields to show. If there any way how I can exclude tabs? Or just simple css to hide?
This code with $data… What is the data should be? =)
if ( $data = bp_get_profile_field_data( ‘field=54’ ) )
It relate to this filter bp_get_profile_field_data
This example will hide tabs and fields to all except admin
function bpfr_hide_profile_field_group( $retval ) {
if ( bp_is_active( 'xprofile' ) ) :
// hide profile group/field to all except admin
if ( !is_super_admin() ) {
//exlude fields, separated by comma
$retval['exclude_fields'] = '1';
//exlude groups, separated by comma
$retval['exclude_groups'] = '3';
}
return $retval;
endif;
}
add_filter( 'bp_after_has_profile_parse_args', 'bpfr_hide_profile_field_group' );
These tricks hide the tab content, not the tab itself. (it seems that it doesn’t work for groups at the moment…i asked devs for information) Use CSS display:none to hide the tab or consider this plugin.
Okay! Thank you very much!
I am really glad to get help here from you.
Thank you again.
@jek-fdrv,
we’ve discussing about this “tab” issue on this ticket:
https://buddypress.trac.wordpress.org/ticket/7304
I invite you to jump in if you have any comments. You might also find a solution for your use case.
Oh, perfect!
I will track this ticket!
Thank you very much again! =)