• Hi – Like others have said the plugin works great but I ran it for 2 days and got charged for 1500 validations from mailgun when in reality it should have been maybe 20 validations at most.
    Is there any thoughts to add some kind of condition for validating such as only for a certain class or input id? That would probably make this work perfectly.
    Paid version with that option maybe?
    I really like the plugin otherwise.
    thanks! – Dave

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Jesin A

    (@jesin)

    Hi Dave,

    Thanks for using the plugin. Does the form in question appear only on a single page? Is it a comment form or a contact/registration form?

    Thread Starter davemfrank

    (@davemfrank)

    Hi Jesin, It is a couple forms on a bunch of pages and they all do contact info, name, email, etc.
    I was just wondering if the validate call can be made to be conditional like if class=’classname’ or if $Input=’#input_id’ then validate function.

    thanks!
    – Dave

    Plugin Author Jesin A

    (@jesin)

    Sorry for the delayed response. You can use the following code to exclude this plugin from pages that don’t have a contact form.

    
    if ( ! is_admin() ) {
            add_filter( 'option_active_plugins', function( $plugins ) {
                    if ( ! isset( $_SERVER['HTTP_REFERER'] ) ) { $_SERVER['HTTP_REFERER'] = null; }
                    $request_uri = parse_url( $_SERVER['REQUEST_URI'], PHP_URL_PATH );
                    $referer_uri = parse_url( $_SERVER['HTTP_REFERER'], PHP_URL_PATH );
                    if ( ! strpos( $request_uri, '/contact-us/' ) && ! strpos( $referer_uri, '/contact-us/' ) ) {
                            $key = array_search( 'mailgun-email-validator/plugin.php', $plugins );
                            if ( false !== $key ) {
                                    unset( $plugins[ $key ] );
                            }
                    }
                    return $plugins;
            });
    }
    

    If you have multiple pages add them all to the if condition:

    
    if ( ! strpos( $request_uri, '/contact-us/' ) && ! strpos( $referer_uri, '/contact-us/' ) && ! strpos( $request_uri, '/page-2/' ) && ! strpos( $referer_uri, '/page-2/' ) ) {
    

    Create a directory named mu-plugins inside wp-content and paste the code in a new file e.g. mailgun-exclude.php

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘tons of validations’ is closed to new replies.