pods-framework / pods-gravity-forms

Integration with Gravity Forms plugin for WordPress (https://pods.io/gravityforms/)
https://wordpress.org/plugins/pods-gravity-forms/
GNU General Public License v2.0
62 stars 10 forks source link

Make it easier for Gravity Flow to support a Pods GF Feed #104

Closed garypaul closed 6 years ago

garypaul commented 6 years ago

Issue Overview

Currently, there isn't a way to conditionally trigger a Pods feed to run. For example, if a form isn't completely filled out or some element doesn't match a specific value. Right now, the Feed will ALWAYS run. This would be similar perhaps to how the MailChimp feed works.

Expected Behavior

If { condition } then run feed.

Current Behavior

Currently, when you submit a form ( the Pods feed will ALWAYS run ). Plugins like Gravity Flow which add workflow steps don't have the opportunity to trigger the feed at a specific point in time.

Possible Solution

Either provide a way to trigger a feed ( in code ) or add conditional statements that another plugin can manipulate to run the feed at a specific time... or after a specific event.

Steps to Reproduce (for bugs)

  1. Install Gravity Flow and Add a Simple WorkFlow with an approval or input step.
  2. Add a new Pod with fields
  3. Add a Pods Feed linking
  4. Submit Form ( goes to approval step )
  5. Notice that Pods Feed was triggered ( the workflow was not yet complete )

Pods Package Export

``` // Available upon request... but shouldn't be terribly relevant in this case. ```
sc0ttkclark commented 6 years ago

Is there a specific action we should add, or do we just add it and Gravity Flow adds support for the action?

naomicbush commented 6 years ago

@sc0ttkclark the standard way to handle this is the process_feed function. But Pods GF has always done things its own way, which I understand since there was no Add-On Framework when you first built it :-)

richardW8k commented 6 years ago

The integration requires extending the Gravity_Flow_Step_Feed_Add_On class like this.

As the add-on doesn't have a process_feed method it would need defining in the step class.

The intercept_submission method may also need overriding in the step with a way to prevent the selected feeds being processed during the original form submission.

The class could be included here or in Gravity Flow.

naomicbush commented 6 years ago

or, you could go ahead and create a step like @richardW8k has mentioned (and was requested in #93) .

But the very least you need to allow other plugins like Gravity Flow "the opportunity to trigger the feed at a specific point in time" is the process_feed function.

And once you add (and use) the process_feed function to handle all of the processing, you can allow conditional logic on the feed (as the original poster requested) by adding a feed_condition field to the feed settings fields.

sc0ttkclark commented 6 years ago

We're now utilizing the process_feed functionality for Pods GF.

Fixed in #86 (ZIP: https://github.com/pods-framework/pods-gravity-forms/archive/feature/skc-fixes.zip)