Unique data

I have a created a custom field and I need to ensure that when a user registers or updates their profile the data enter for this field  will be checked and if it is not unique they will see an error message (similar to the how the user name or email fields work).

Is this possible/could someone give me a pointer on how to go about this? 

Great plugin by the way Kevin!

  • You need to create a validation function in a custom field type.

    See this function:

    form_custom_field_type_manager

    in form/models/model.php

    If the validation function returns false or an error message string, then the form should be redisplayed. If true, it will be accepted.

    Full form validation works for registration forms but not profile forms right now.

    If you want profile validation you can listen for the 'profilepreupdate' event and return false.

    See mod/flexprofile/actions/edit.php

    This will prevent the profile from being updated (but throws away all the profile edits, so is annoying for the user).

  • Thanks Kevin - this is right on the limit of my elgg knowledge right now so I'll give it a go and report back...

     

     

Form and related plugins

Form and related plugins

User-generated content, flexible user and group profiles, registration forms, custom file forms