diff --git a/gp-nested-forms/gpnf-process-gpgs-feed-on-nested-after-parent-workflow-complete.php b/gp-nested-forms/gpnf-process-gpgs-feed-on-nested-after-parent-workflow-complete.php new file mode 100644 index 000000000..787a03c42 --- /dev/null +++ b/gp-nested-forms/gpnf-process-gpgs-feed-on-nested-after-parent-workflow-complete.php @@ -0,0 +1,55 @@ +id ] ); + $nested_entries = array_merge( $nested_entries, $_entries ); + } + } + $nested_entries = array_unique( $nested_entries ); + + // process each nested entry + foreach( $nested_entries as $nested_entry_id ) { + $nested_entry = GFAPI::get_entry( $nested_entry_id ); + if ( empty( $nested_entry_id ) || empty( $nested_entry ) || is_wp_error( $nested_entry ) ) { + continue; + } + + $feeds = gp_google_sheets()->get_active_feeds( $nested_entry['form_id'] ); + if ( empty( $feeds ) ) { + return; + } + + // process feeds + foreach ( $feeds as $feed ) { + if ( rgar( $feed, 'addon_slug') !== 'gp-google-sheets' ) { + continue; + } + //process the google sheets feed for the nested entry + gp_google_sheets()->process_feed( $feed, $nested_entry, GFAPI::get_form( $nested_entry['form_id'] ) ); + } + } + } +}