Support

Home Forums Event Espresso Premium EE3 – Limit Registrant's Email Address

EE3 – Limit Registrant's Email Address

Posted: October 29, 2015 at 9:39 pm

Viewing 14 reply threads


YIPENG ZHANG

October 29, 2015 at 9:39 pm

Is there any possibility that could limit the email address? E.g. only allow/disallow email address with certain keyword like “hotmail.com”

Thanks!


Lorenzo Orlando Caum

  • Support Staff

October 30, 2015 at 6:06 am

Hi Yipeng,

There isn’t a built-in option that can do that but we may be able to find a jQuery solution that could help.

Could you share more information on why you are wanting to restrict a certain email domain?


Lorenzo


YIPENG ZHANG

October 30, 2015 at 6:11 am

I would like to restrict QQ.COM since our transactional email provider Mandrill is unable to deliver any mail to QQ.COM due to QQ’s strict email policy though Mandrill says they have delivered the mail.

Would like to see this in two approach, one is to restrict like I just mentioned above, another is to allow registration only from certain domain like our organization domain.

Thanks!


Lorenzo Orlando Caum

  • Support Staff

October 30, 2015 at 6:23 am

Hi, I found an example that may work. How about something like this?

http://www.designchemical.com/blog/index.php/jquery/email-validation-using-jquery/

Demo page:

http://www.designchemical.com/lab/jquery/demo/jquery_email_validation.htm


Lorenzo


YIPENG ZHANG

October 30, 2015 at 6:40 am

lookslike his would work. What file should I put these in?


Lorenzo Orlando Caum

  • Support Staff

October 30, 2015 at 8:23 am

Hi, could you try this out?

https://gist.github.com/lorenzocaum/999801967e0157803004

If your event-registration page has a different slug, then change event-registration to your actual page slug in the function.

You can try it out in your child theme’s functions.php file or through a site specific plugin.


Lorenzo


YIPENG ZHANG

October 30, 2015 at 9:24 am

//* Restrict certain domains
function ee_restrict_certain_email_domains() {
    if ( is_page( 'ticketing' ) ) {
        ?>
<script type="text/javascript">
// prepare the form when the DOM is ready 
jQuery(document).ready(function() { 

        jQuery('input[id$="event_form_field-"]').click(function() {  

                jQuery(".error").hide();
                var hasError = false;
                var emailReg = /^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/;
                var emailblockReg =  /^([\w-\.]+@(?!qq.com)([\w-]+\.)+[\w-]{2,4})?$/;

                var emailaddressVal = jQuery('input[id^="email-"]').val();
                if(emailaddressVal == '') {
                    jQuery('input[id^="email-"]').after('<span class="error">Please enter your email address.</span>');
                    hasError = true;
                } else if(!emailReg.test(emailaddressVal)) {    
                    jQuery('input[id^="email-"]').after('<span class="error">Enter a valid email address.</span>');
                    hasError = true;
                } else if(!emailblockReg.test(emailaddressVal)) {   
                    jQuery('input[id^="email-"]').after('<span class="error">No QQ Mail.</span>');
                    hasError = true;
                } 

                if(hasError == true) { return false; }
                else {
                    jQuery('input[id^="email-"]').after('<span class="error">Email accepted.</span>');
                    return false;
                }
    }); 
});
</script>
        <?php
    }
}
add_action('wp_footer', 'ee_restrict_certain_email_domains');

This is the code I put in in my site plugin but it did not work


Lorenzo Orlando Caum

  • Support Staff

October 30, 2015 at 4:13 pm

Hi, could you post your ticketing page so I can take a look?

The code is doing a partial match for certain form elements so if yours are different then it will need to be revised.

Thanks


Lorenzo


YIPENG ZHANG

October 30, 2015 at 5:17 pm

Hello – please visit https://www.cssalondon.org/ticketing/?ee=1

Thanks so much!!


Lorenzo Orlando Caum

  • Support Staff

November 2, 2015 at 8:36 am

Hi, could you create another test event and share the link?

The one that you provided is closed.

Specifically, I’d like to see the registration form on the page so I can troubleshoot the jQuery to get that working.

Thanks


Lorenzo


YIPENG ZHANG

November 11, 2015 at 6:58 pm

Hello Lorenzo

I have reenabled that event. Please visit https://www.cssalondon.org/ticketing/?ee=1 again:)

Yipeng


Lorenzo Orlando Caum

  • Support Staff

November 12, 2015 at 7:16 am

Hi, I made a few changes and verified that it works:

https://gist.github.com/lorenzocaum/999801967e0157803004

The main change is changing:

input[id$=”event_form_field-“]

…to this:

input[id^=”event_form_field-“]


Lorenzo


YIPENG ZHANG

November 15, 2015 at 8:05 pm

Hello Lorenzo,

What happens then is after I input my email address I am unable to submit the registration. Please take a look at https://www.cssalondon.org/ticketing/?ee=1 again.


Lorenzo Orlando Caum

  • Support Staff

November 16, 2015 at 7:25 am

See the updated code:

https://gist.github.com/lorenzocaum/999801967e0157803004

I removed the confirmation when a valid email is used.


Lorenzo


YIPENG ZHANG

November 23, 2015 at 5:48 pm

Hello Lorenzo

This code works! Thanks so much:)

You may close this thread.

Viewing 14 reply threads

The support post ‘EE3 – Limit Registrant's Email Address’ 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