I have this little problem with a custom field that is bundled with user. In its validation function I need to have access to the user id of the user whose field is being edited.
What that means is, when I edit a user, I need to get his uid in the validation function.
The problem is that hook_field_validate provides just $entity variable that doesn't include uid.
I know I could load the user object using his email / name (and then retrieve the uid from it) but it wouldn't properly work when email/name was being changed (I could get only the changed values from $entity and therefore wouldn't be able to load the object properly).
Any ideas?
hook_field_validate
$entity_type == 'user'
), but $entity->uid is empty for edits to existing users?