Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save verygoodplugins/ef36b8673b7725bdad97dbd44aaad853 to your computer and use it in GitHub Desktop.
Save verygoodplugins/ef36b8673b7725bdad97dbd44aaad853 to your computer and use it in GitHub Desktop.
Adds additional contacts to Infusionsoft when a Gravity Form is submitted
<?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