Skip to:
Content
Pages
Categories
Search
Top
Bottom

Re: Disable name change for users


Boone Gorges
Keymaster

@boonebgorges

Try this on for size. Hackish but functional, until real exclude arguments exist (they’re coming in 1.3, I promise!) Put it in your bp-custom.php

`function bbg_disallow_name_edit( $has_profile ) {
global $profile_template, $bp;

if ( ‘edit’ != $bp->current_action || !bp_is_my_profile() )
return $has_profile;

foreach( (array)$profile_template->groups as $group_key => $group ) {
foreach( (array)$group->fields as $field_key => $field ) {
if ( $field->name == BP_XPROFILE_FULLNAME_FIELD_NAME ) {
unset( $profile_template->groups[$group_key]->fields[$field_key] );
$profile_template->groups[$group_key]->fields = array_values(
$profile_template->groups[$group_key]->fields );
break 2;
}
}
}

return $has_profile;
}
add_filter( ‘bp_has_profile’, ‘bbg_disallow_name_edit’ );`

Skip to toolbar