break;
case 'newMembership':
+ // Check the form for reCaptcha
+ $response = wp_remote_post( 'https://www.google.com/recaptcha/api/siteverify', array(
+ 'method' => 'POST',
+ 'timeout' => 45,
+ 'redirection' => 5,
+ 'httpversion' => '1.0',
+ 'blocking' => true,
+ 'headers' => array(),
+ 'body' => array(
+ 'secret' => '6LfEilYUAAAAAIcRJthzVTjLxiznY4DiYP3zDqIw',
+ 'response' => $_REQUEST['g-recaptcha-response'],
+ 'remoteip' => $_SERVER['REMOTE_ADDR']
+ ),
+ 'cookies' => array()
+ ) );
+
+ $response_code = wp_remote_retrieve_response_code( $response );
+ $api_response = json_decode( wp_remote_retrieve_body( $response ), true );
+ if ( $api_response['success'] != true ) {
+ $error = true;
+ $messages[] = $errors['email'] = "<span style='color: red;'>Invalid Captcha value!</span>";
+ }
+
$payable_types = $BillingSupport->getAllPayableInvoiceTypes();
// $messages[] = '<pre>$_REQUEST: ' . print_r( $_REQUEST, true ) . '</pre>';
// Need to see if the email address they're using is already setup as a contact.
break;
default:
+ wp_register_script( 'recaptcha', 'https://www.google.com/recaptcha/api.js' );
+ wp_enqueue_script( 'recaptcha' );
$payable_types = $BillingSupport->getAllPayableInvoiceTypes();
break;