Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save spivurno/4055175 to your computer and use it in GitHub Desktop.
Save spivurno/4055175 to your computer and use it in GitHub Desktop.
Gravity Wiz: Ban/Limit Email Domains Usage Examples
<?php
// standard usage
new GWEmailDomainControl(array(
'form_id' => 152,
'field_id' => 9,
'domains' => array('gmail.com', 'hotmail.com', 'test.com')
));
// all options
new GWEmailDomainControl(array(
'form_id' => 152,
'field_id' => 9, // multiple field IDs can be passed as an array: array(8,9)
'domains' => array('gmail.com', 'hotmail.com', 'test.com'),
'validation_message' => __('Oh no! <strong>%s</strong> email accounts are not eligible for this form.'),
'mode' => 'ban' // also accepts "limit"
));
// limit mode applied to two specific fields
new GWEmailDomainControl(array(
'form_id' => 152,
'field_id' => 9,
'domains' => array('gmail.com', 'hotmail.com', 'test.com'),
'mode' => 'limit'
));
// apply to all email fields on a form
new GWEmailDomainControl(array(
'form_id' => 152,
'domains' => array('gmail.com', 'hotmail.com', 'test.com')
));
@buckneri
Copy link

buckneri commented May 1, 2017

Doesn't seem to work any more. Can this be added in a plugin? i have a custom plugin that adds a functions.php file and other things and i added the code there, but it allows me to register with all blocked email addresses.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment