Gravity forms hook gform_after_submission is executed at the end of the submission process (after form validation, the notifications and the entry creation)
As such, this is the ideal hook to use to perform any actions that need to take place with the entry data – ie, feed data to a 3rd party application)
As with other Gravity form hooks and filters, it can apply to all
add_action( 'gform_after_submission', 'ns_after_submission', 10, 2 );
or, just apply to a specific form as identified by it’s form ID (Form 3 in this case)
add_action( 'gform_after_submission_3', 'ns_after_submission', 10, 2 );
In the example below, the form is a submission for for entry into a member directory (member custom post, with business-category as a custom taxonomy selected from a multi-select drop down populated with taxonomy terms and then extracted into use-able format using get_value_export)
add_action( 'gform_after_submission_3', 'set_post_content', 10, 2 );
function set_post_content( $entry, $form ) {
$applicationtype = rgar( $entry, '1' );
if ($applicationtype =='New')
{
$companyname = rgar( $entry, '2' );
$contactfname = rgar( $entry, '3' );
$contactfname = rgar( $entry, '36');
$contactrole = rgar( $entry, '6' );
$phone = rgar( $entry, '16' );
$email = rgar( $entry, '10' );
$address1 = rgar( $entry, '8' );
$address2 = rgar( $entry, '9' );
$website = rgar( $entry, '11' );
$logourl = rgar( $entry, '12' );
//Get BusinesCategories from multiselect
$field = GFFormsModel::get_field( $form,39 );
$businessat= $field->get_value_export( $entry, 39 );
$membertax = array(
'business-category' => str_getcsv($businessat) ,
);
$newmember = array(
'post_title' => wp_strip_all_tags( $companyname ),
'post_content' => $logourl,
'post_status' => 'publish',
'post_author' => 1,
'post_type' =>'member',
'tax_input' => $membertax,
'meta_input' => array(
'lc_gwl_member_contactname' => $contactfname.' '.$contactfname,
'lc_gwl_member_contacttitle' => contactrole,
'lc_gwl_member_tel' => $phone,
'lc_gwl_member_address1' => $address1,
'lc_gwl_member_address2' => $address2,
'lc_gwl_member_email' => $email,
'lc_gwl_member_website' => $website,
));
$post_id = wp_insert_post( $newmember );
//Check that post is valid
if(!is_wp_error($post_id)){
//the post is valid so do something (add featured image?)
}else{
//there was an error in the post insertion,
echo $post_id->get_error_message();
}
}
}