spivurno
11/11/2012 - 3:07 PM

Gravity Wiz: Ban/Limit Email Domains Usage Examples

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')
    ));