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!
info@elgg.org
Security issues should be reported to security@elgg.org!
©2014 the Elgg Foundation
Elgg is a registered trademark of Thematic Networks.
Cover image by Raül Utrera is used under Creative Commons license.
Icons by Flaticon and FontAwesome.
- Kevin Jardine@kevin

Kevin Jardine - 0 likes
- jj01@jj01

jj01 - 0 likes
You must log in to post replies.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...