Skip to content

Filters

Alex Bondarev edited this page May 23, 2022 · 31 revisions

kickbox_gf_validation_priority

Filter kickbox_gf_validation_priority allows to change the default validation priority.

Params:

Name Type Description Default
$priority int WordPress priority for apply_filters() 11

Example:

add_filter( 'kickbox_gf_validation_priority', function () {
    return 10;
} );

kickbox_gf_api_key

Filter kickbox_gf_api_key allows to specify a Kickbox API key. Defaults to the value set on the plugin settings page.

Params:

Name Type Description
$api_key string Kickbox API key

Example:

add_filter( 'kickbox_gf_api_key', function () {
    return 'KICKBOX_API_KEY'; // use a valid Kickbox API key
} );

kickbox_gf_field_name_before_verification

Filter kickbox_gf_field_name_before_verification allows to change the field name before getting its value from $_POST. Defaults to "input_{$field['id']}".

Params:

Name Type Description
$field_name string Field name attribute

kickbox_gf_field_value_before_verification

Filter kickbox_gf_field_value_before_verification allows to change the passed field value before verification.

Params:

Name Type Description
$field_value string Submitted value

kickbox_gf_verification

Filter kickbox_gf_verification allows to change the verification. NB: This filter fires for cached verifications too.

Params:

Name Type Description
$verification array Email verification result

Example:

add_filter( 'kickbox_gf_verification', function ( $verification ) {
    return $verification;
} );

kickbox_gf_interpretation

Filter kickbox_gf_interpretation allows to change the interpretation. NB: This filter fires for failed verifications too.

Params:

Name Type Description
$interpretation array Verification interpretation

Example:

add_filter( 'kickbox_gf_interpretation', function ( $interpretation ) {
    return $interpretation;
} );

kickbox_gf_ignored_reasons

Filter kickbox_gf_ignored_reasons allows to modify the list of Kickbox reasons that should be ignored and interpreted as valid.

Params:

Name Type Description Default
$reasons array Kickbox reasons to be interpreted as valid array( "timeout", "unexpected_error" )

Example:

add_filter( 'kickbox_gf_ignored_reasons', function ( $reasons ) {
    return array();
} );

kickbox_gf_configuration

Filter kickbox_gf_configuration allows to modify the Kickbox settings to check values against.

Params:

Name Type Description Default
$config array Kickbox validation configuration array( 'valid-types' => array( 'deliverable' ), 'sendex' => 0.4 )

Example:

add_filter( 'kickbox_gf_configuration', function ( $config ) {
    $config['sendex']      = 0.7;
    $config['valid-types'] = array( 'deliverable', 'risky', 'unknown' );

    return $config;
} );

Caching

kickbox_gf_cache_item

Filter kickbox_gf_cache_item allows to modify the item that is going to be cached.

Params:

Name Type Description Default
$item array Item to store in the DB. NB: Do not modify existing key names. array( 'kickbox' => $verification, 'verification-timestamp' => time() )

kickbox_gf_verification_cache_key

Filter kickbox_gf_verification_cache_key allows to modify the item that is going to be cached.

Params:

Name Type Description
$cache_key string Cache key name for $email.
$email string Verified email to cache.

kickbox_gf_results_caching_duration

Filter kickbox_gf_results_caching_duration allows to modify the caching duration. A daily cron-job would be added to prune old caches.

Params:

Name Type Description
$duration int Cache duration (in days).

Error messages

kickbox_gf_generic_error_message

Filter kickbox_gf_generic_error_message allows to modify the generic error message that will be shown for invalid email verifications.

Params:

Name Type Description Default
$error_message string Error message. An i18n'ed There seems to be an issue with your email address..

kickbox_gf_{$reason}_error_message

Dynamic filter kickbox_gf_{$reason}_error_message allows to modify the error messages that will be shown for various Kickbox reasons.

Params:

Name Type Description
$message string Message to show for a specific $reason.

Example:

add_filter( 'kickbox_gf_invalid_smtp_error_message', function ( $message ) {
    return esc_html__( "There seems to be an issue with your email provider's SMTP server.", "your-text-domain" );
} );

kickbox_gf_form_{$form['id']}_{$reason}_error_message

Dynamic filter kickbox_gf_form_{$form['id']}_{$reason}_error_message allows to modify the error messages that will be shown for various Kickbox reasons for a specific form.

Params:

Name Type Description
$message string Message to show for a specific $reason for a specific $form['id'].