• Resolved Naqi

    (@naqirizvi)


    Hello,

    As Contact Form 7 and other similar plugins uses WordPress is_email function.
    What I want to achieve is to get the email which was submitted on Caldera form and sent it to an API for Email Validation.
    Which will gives me real time output if email is valid or not.

    A Valid email results in Successful form submission.

    Let me know which hook should I use to get it working.

    My current approach with is_email is working with other forms but not with Caldera Forms it sends me loggedin_user_email instead of sending me form email.

    How my current plugin looks like

    add_filter( 'is_email', 'email_checker_validate');
    function email_checker_validate($emailAddress){
    	$api_key	= get_option('emailchecker_api_key');
    		$verfication_url	= 'https://examle.com/api.php?secret='.$api_key.'&email='.$emailAddress;
    		$verfication_response = wp_remote_get( $verfication_url, array( 'timeout' => 60 ) );
    		if ( !is_wp_error( $verfication_response ) ) {
    			$verfication_response = json_decode($verfication_response['body'],true);
    			if ($verfication_response['status'] == "ok"){
    				return true;	//Email Valid, Accept form submission
    			}else{
    				return false;	//Email Invalid, Decline Form submission and gives error
    			}}}
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘is_email function’ is closed to new replies.