Support

Home Forums Event Espresso Premium [EE4 / registration form] limit user e-mail to specific domain

[EE4 / registration form] limit user e-mail to specific domain

Posted: August 2, 2017 at 5:11 am


Anonymous

August 2, 2017 at 5:11 am

Hello, I am creating an event registration website for my client. The event is only for my clients’ employees, therefore I would like to limit the user e-mail input to (or validate it against) a specific domain name (eg. *@xyz.com). How can I do that?


Josh

  • Support Staff

August 2, 2017 at 11:07 am

Hi freshform,

You can use the WordPress is_email filter hook to perform custom email validation. There’s some example code in this gist:

https://gist.github.com/joshfeck/c3236ca17bfe3df5b3e5340183eb56c6

You can add the above to a functions plugin. The above filter function will be applied if you have the “Email Validation Level” option set to “WordPress Default” in Event Espresso > Registration Form > Reg Form Settings.


Anonymous

August 2, 2017 at 12:45 pm

Hi Josh, thank you for your support!


Anonymous

August 2, 2017 at 12:53 pm

Josh, I have another question connected with the previous one – how do I change the validation error message (if the given e-mail is from outside the allowed domains)?


Josh

  • Support Staff

August 2, 2017 at 1:38 pm

Hi freshform,

You can change any translatable string with a translation function:

https://eventespresso.com/wiki/how-to-change-wording-with-poedit/#custom-function

The specific strings in this case are:
An error has occurred:<br />
Please enter a valid email address.

So in the above code you’ll include the following in the array of strings:

'An error has occurred:<br />' => 'Your replacement here<br />',
'Please enter a valid email address.' => 'Your replacement here',


Anonymous

August 3, 2017 at 1:33 am

Hi Josh, thanks again!

The support post ‘[EE4 / registration form] limit user e-mail to specific domain’ is closed to new replies.

Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.

Event Espresso