Last active
July 28, 2025 15:53
-
-
Save csalzano/dfd754e0fe8b6ac10731fad8f257c0bf to your computer and use it in GitHub Desktop.
Revisions
-
csalzano revised this gist
Sep 11, 2021 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -32,8 +32,8 @@ function manipulate_form_submission( $record, $ajax_handler ) { //if the failure of our additional webhook should prevent the form from submitting... if( is_wp_error( $response ) ) { $msg = 'There was a problem with the additional webhook.'; $ajax_handler->add_error( 0, $msg ); $ajax_handler->add_error_message( $msg ); $ajax_handler->is_success = false; } -
csalzano revised this gist
Sep 11, 2021 . 1 changed file with 7 additions and 8 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,11 +1,11 @@ <?php /** * Plugin Name: Elementor Form Additional Webhook * Plugin URI: https://gist.github.com/csalzano/dfd754e0fe8b6ac10731fad8f257c0bf * Description: Adds a second Webhook to an Elementor form * Version: 1.0.1 * Author: Corey Salzano * Author URI: https://breakfastco.xyz/ * License: GPLv2 or later * License URI: http://www.gnu.org/licenses/gpl-2.0.html */ @@ -23,9 +23,9 @@ function manipulate_form_submission( $record, $ajax_handler ) { //change the names of fields before we send them somewhere $new_data = array( 'First_Name' => $form_data['First Name'] ?? '', 'Last_Name' => $form_data['Last Name'] ?? '', 'URL' => $form_data['Website'] ?? '', ); $response = wp_remote_post( 'http://api.somewhere.com/', array( 'body' => $new_data ) ); @@ -35,7 +35,6 @@ function manipulate_form_submission( $record, $ajax_handler ) { $msg = 'There was a problem launching the rocket. Please check with mission control.'; $ajax_handler->add_error( $field['id'], $msg ); $ajax_handler->add_error_message( $msg ); $ajax_handler->is_success = false; } } -
csalzano created this gist
Jun 15, 2018 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,44 @@ <?php /** * Plugin Name: Elementor Form Additional Webhook * Plugin URI: https://coreysalzano.com/ * Description: Adds a second Webhook to the Lot Wizard trial signup form * Version: 1.0.0 * Author: Corey Salzano * Author URI: https://github.com/mistercorey * License: GPLv2 or later * License URI: http://www.gnu.org/licenses/gpl-2.0.html */ class Elementor_Form_Additional_Webhook { function hooks(){ //Add our additional webhook right here add_action( 'elementor_pro/forms/new_record', array( $this, 'manipulate_form_submission' ), 10, 2 ); } function manipulate_form_submission( $record, $ajax_handler ) { $form_data = $record->get_formatted_data(); //change the names of fields before we send them somewhere $new_data = array( 'First_Name' => isset( $form_data['First Name'] ) ? $form_data['First Name'] : '', 'Last_Name' => isset( $form_data['Last Name'] ) ? $form_data['Last Name'] : '', 'URL' => isset( $form_data['Website'] ) ? $form_data['Website'] : '', ); $response = wp_remote_post( 'http://api.somewhere.com/', array( 'body' => $new_data ) ); //if the failure of our additional webhook should prevent the form from submitting... if( is_wp_error( $response ) ) { $msg = 'There was a problem launching the rocket. Please check with mission control.'; $ajax_handler->add_error( $field['id'], $msg ); $ajax_handler->add_error_message( $msg ); $ajax_handler->is_success = false; } } } $elementor_webhook_239909870234 = new Elementor_Form_Additional_Webhook(); $elementor_webhook_239909870234->hooks();