Gravityforms write to SQL with the WPDB plugin

This week I ‘ave mostly been… trying to create a Gravity Form to allow users to pay for a Memberpress subscription using Stripe and then login and immediately get access to the subscribed content. Apart from that, i want to store my form data so I can review the new customer information from my SQL database at anytime – step up the WPDB Connect Plugin which does this job admirably…. ish…

With one small but very annoying error.

Strangely enough – I only see this error message for users subscribing when they are not logged in.

Notice: Undefined variable: form in /wp-content/plugins/gravityforms_wpdb-connect/class.gravityforms_wpdb-connect.php on line 611

I looked around while I’m waiting for the support team to write a proper fix and I found a nice little quick and dirty solution: we can check if this PHP variable exists before we use it. If it doesn’t exist then we are here in error so gracefully. It goes to sleep nicely, still works as planned and just quietly gets on with thing without spitting out any angry error messages.

Simply go and edit /wp-content/plugins/gravityforms_wpdb-connect/class.gravityforms_wpdb-connect.php

Add the lines I marked as NJL

 * process the feeds after the entry was changed with the GFAPI
 * @param object $entry the current entry
 * @param object $original_entry the entry before the changes
 * @return

function spgfwpdb_gform_post_update_entry( $entry, $original_entry )

/** NJL added by to capture undefined $form variable */
 if(isset($form)) {

 * loop thru and process the feeds
 $feeds = GFAPI::get_feeds( NULL, $entry[ 'form_id' ], $this->_slug );
 foreach( (array)$feeds AS $feed )
 self::process_feed_update( $feed, $entry, $form );

} /** NJL */