Field edit limit for users I need to set a limit on the number of times a field can be edited.

use case: the name of the user (field_name_user) can only be edited once or twice.

I tried node edit limit and field permissions but neither won't fit the task. Is ther any other module out there or a way to achieve this?
I think you can achieve this using an entity field, in this case the user entity, and some PHP Code.

Add a Field that counts the numebr of editions. Then, alter the entity edit form (in this case again, the user edit form) and:


Hide the field (with #access FALSE, for example).
Add your custom submit handler to the entity edit form.
If the field value is minor than the max edit count allow to edit
then increment the field value in a custom submit handler.
If the field value is equal to the max edit count then deny the
edition (deny the edit form, hide the field or whatever you want and
fit your needs).


Also don't forget to hide the field when the entity is shown (check the entity display settings page).