Skip to:
Content
Pages
Categories
Search
Top
Bottom

Reply To: [Resolved] how to make some xprofile field to uneditable

@1a-spielwiese

Participant

For me also not:

I tried it with

Mitglieder-Kategorie (Team oder Fan?)

instead of

'name of your field'

as well as with

'Mitglieder-Kategorie (Team oder Fan?)'

But my users can still change the values for this field. –

I tried as well – already before and now again – this code of @noizeburger:

//hide the user role select field in edit-screen to prevent changes after registration
add_filter("xprofile_group_fields","bpdev_filter_profile_fields_by_usertype",10,2);
function bpdev_filter_profile_fields_by_usertype($fields,$group_id){
//only disable these fields on edit page
if(!bp_is_profile_edit())
return $fields;
//please change it with the name of fields you don't want to allow editing
$field_to_remove=array("User Role");
$count=count($fields);
$flds=array();
for($i=0;$i<$count;$i++){
if(in_array($fields[$i]->name,$field_to_remove))
unset($fields[$i]);
else
$flds[]=$fields[$i];//doh, I did not remember a way to reset the index, so creating a new array
}
return $flds;
}

It works neither with

"Mitglieder-Kategorie (Team oder Fan?)"

nor with

Mitglieder-Kategorie (Team oder Fan?)

nor with:

'Mitglieder-Kategorie (Team oder Fan?)'

Skip to toolbar