I am using drupal 7 and want to save unique mobile number for users. I have created a profile type field of phone number type.I have installed unique field module but not getting any option to make it unique while editing the phone number type field. I want make it a unique so there will be one mobile number for only one user.So how can we make a unique field in a profile types? Or will we have to make a unique field in a database itself??


You can use the http://drupal.org/project/field_validation for unique validation. When this module is enabled, there is a validation tab for each fields in content type. If you want to validate the unique value. Just go validation tab and click on the "Unique values", do some configuration, the unique value rule will be applied for current field.


This is by design in the unique_fields module, they only provide this functionality for content types, not profile fields according to the maintainers: http://drupal.org/node/476064. They suggest writing your own validation hooks:

To implement a uniqueness requirement for Drupal profile fields, you would probably use hook_user() to add extra validation (comparing the submitted value against other existing values) for the profile fields you want to be unique.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.