Dannymh
Active member
Hi,
I think this may be due to permissions. but am trying to find a way around it.
I have a custom user field but the user field is not editable by end users only Admin and Moderator. However the field needs to be checked by code if certain conditions are met.
I run the code and everything else saves but the custom field does not.
At the moment the user field is a drop down with a yes/no value I run
However the user cant update it as the permissions are set in the custom field to be not editable by the user. Am I correct in thinking this is a restriction in the Entity due to that permission and is there possibly any other way that I may be able to update it from my code?
I think this may be due to permissions. but am trying to find a way around it.
I have a custom user field but the user field is not editable by end users only Admin and Moderator. However the field needs to be checked by code if certain conditions are met.
I run the code and everything else saves but the custom field does not.
At the moment the user field is a drop down with a yes/no value I run
PHP:
$userEm = $app->em()->findOne('XF:User', ['user_id' => $json["vendorData"]]);
$userEm->Profile->custom_fields->otbVerified = 'yes';
$userEm->save();
However the user cant update it as the permissions are set in the custom field to be not editable by the user. Am I correct in thinking this is a restriction in the Entity due to that permission and is there possibly any other way that I may be able to update it from my code?