Created
June 6, 2018 16:39
-
-
Save verygoodplugins/ef36b8673b7725bdad97dbd44aaad853 to your computer and use it in GitHub Desktop.
Adds additional contacts to Infusionsoft when a Gravity Form is submitted
This file contains 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 characters
<?php | |
function my_gform_after_submission( $entry, $form ) { | |
// Gets the first name and last name from field ID 3, and email from field ID 4 | |
$contact_data = array( | |
'FirstName' => rgar( $entry, '3.3' ), | |
'LastName' => rgar( $entry, '3.6' ), | |
'Email' => rgar( $entry, '4' ) | |
); | |
$contact_id_one = wp_fusion()->crm->add_contact( $contact_data, false ); | |
// Gets the first name and last name from field ID 5, and email from field ID 6 | |
$contact_data = array( | |
'FirstName' => rgar( $entry, '5.3' ), | |
'LastName' => rgar( $entry, '5.6' ), | |
'Email' => rgar( $entry, '6' ) | |
); | |
$contact_id_two = wp_fusion()->crm->add_contact( $contact_data, false ); | |
} | |
// Replace "1" with the ID of the form | |
add_action( 'gform_after_submission_1', 'my_gform_after_submission', 10, 2 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment