Gravity Forms gform_after_submission Help

I will try to keep this as short as I can but there are a lot of moving parts here.

I am using Gravity Forms to make a very complex form, the form is about 45 pages long but is broken up into separate forms that pass data between using Easy Passthrough. This was done because we were facing performance issues when we had one large mega form.

The form is an insurance form and each page is an individual carrier, using Gravity Flow, after each page of the form is submitted, the data is mapped into a master form. This form is not front facing and is just used to pull data from using Gravity View and Gravity PDF to reference.

The master form has a field in it with a calculation, the calculation is adding up the total of each insurance carrier to then give you a master total. This is pulled out to be displayed in a Gravity View for the user to see, as well as pulled out to dynamically generate a PDF to view.

The problem is that because the master form is not front facing, the sum calculation has nothing to trigger it. Initially, I was using [this](https://github.com/gravitywiz/snippet-library/blob/master/experimental/gpdtc-calculated-input-value.php) code snippet to trigger the sum on the master form. However, this triggered every single calculated field and caused very slow load times between pages.

My next idea was to use the gform\_after\_submission filter to run a database query just on the master form to trigger the calculation needed. I want it to run the MySQL query through the $wpdb global variable. [Here](https://pastebin.com/pu61zUdM) is the code snippet I am trying to use, given to me by Gravity Flow.

However, when I run this nothing happens. Not even the debug logging. Does anybody know what is happening or have any alternative fixes? Thank you so much!

\-M

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer