gform_post_process_feed

gform_post_process_feed

DescriptionUsageParametersExamples1. Send Notification2. Trigger Slack FeedSource CodeSince

Description
The gform_post_process_feed hook can be used to perform a custom action when a feed has been processed.
Usage
The hook which would run for all add-on feeds would be used like so:
1add_action( 'gform_post_process_feed', 'your_function_name', 10, 4 );
You can target a specific add-on with the following variation of this hook:
1add_action( 'gform_{ADDON_SLUG}_post_process_feed', 'your_function_name', 10, 4 );
See the Gravity Forms Add-On Slugs article for a list of possible slugs.

Parameters

$feed Feed Object
The Feed Object which was just processed.

$entry Entry Object
The current entry object, which may have been modified by the processed feed.

$form Form Object
The current form object.

$addon object
The current instance of the GFAddOn object which extends GFFeedAddOn or GFPaymentAddOn (i.e. GFCoupons, GF_User_Registration, GFStripe).

Examples
1. Send Notification
The following example shows how you can send a notification once a feed has been processed. You can use the gform_notification_events filter to make new events available for selection when users are configuring notifications.
1234add_action( 'gform_post_process_feed', 'post_process_feed', 10, 4 );function post_process_feed( $feed, $entry, $form, $addon ) {    GFAPI::send_notifications( $form, $entry, 'some_event' );}
2. Trigger Slack Feed
This example shows how you can trigger the processing of Slack feeds for this entry after the User Registration Add-On has created the pending activation.
1234567add_action( 'gform_gravityformsuserregistration_post_process_feed', 'process_slack_feeds_post_ur', 10, 3 );function process_slack_feeds_post_ur( $feed, $entry, $form ) {    $key = gform_get_meta( $entry['id'], 'activation_key' );    if ( $key && function_exists( 'gf_slack' ) ) {        gf_slack()->maybe_process_feed( $entry, $form );    }}
Source Code
This action hook is located in GFFeedAddOn::maybe_process_feed() in /includes/addons/class-gf-feed-addon.php.
Since
This hook was added in Gravity Forms 2.0-beta-3.

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注