Gravity Forms sending entry data combined from multiple forms to third-party after submitting a specific form Gravity Forms sending entry data combined from multiple forms to third-party after submitting a specific form wordpress wordpress

Gravity Forms sending entry data combined from multiple forms to third-party after submitting a specific form


Because you are specifying the form ID in the add_action itself, you are only running your function when the Gravity Form, with an ID of 2, is submitted. If you want it to run for multiple submissions, but then limit it to specific form IDs, then something more like this:

   add_action( 'gform_after_submission', 'post_to_third_party', 10, 2 );   function post_to_third_party( $entry, $form ) {    if( $form->id == 2 || $form->id == somenumber ) {        $post_url = 'http://thirdparty.com';        $body = array(            'first_name' => rgar( $entry, '1.3' ),             'last_name' => rgar( $entry, '1.6' ),             'message' => rgar( $entry, '3' ),        );        $request = new WP_Http();        $response = $request->post( $post_url, array( 'body' => $body ) );    }}

You might need to use $form['id'] in the event you aren't dealing with the object. One of them will work. The downside is you must know the ID of the forms you want to work with. This is easily found in the backend when viewing the table of forms you've created, but it is what it is...


If you are saving form data to the same post maybe you can get the date based on post id