I have a function that lets you update your information, like email and username. The email field has a validation is_unique[table.email]. When lets say the user doesn’t want to change the email, but just the country or other info, the is_unique is going to display the message. But if I remove it in update page, the user might put an email address that is already in database.
What would be best logical method of solving this issue?
Assuming you are using a database query and counting the number of rows it returns (0 meaning that the address is free), you’ll want to pass the user’s unique ID along:
What I just did above will check if anyone other than our current user is signed up with the requested email. If this user wants to just update his/her country, it won’t trigger an error.
edit: This would be in your custom form validation rule __unique_email() or something similar. Which needs to be in the controller.