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.

gform_post_payment_transaction

gform_post_payment_transaction

DescriptionUsageParametersExamplesSource Code

Description
Triggered after a payment transaction is created within Gravity Forms.
Usage
1add_action( 'gform_post_payment_transaction', 'my_function', 10, 6 );

Parameters

$txn_id integer
The transaction ID associated with the payment.

$entry_id integer
The ID of the entry that was created.

$transaction_type string
The type of transaction that was made.

$transaction_id integer
The transaction ID of the newly created transaction.

$amount string
The total amount of the payment.

$is_recurring bool
Returns true if recurring. Otherwise, false.

Examples
1234function my_function() {    //Do something here}add_action( 'gform_post_payment_transaction', 'my_function', 10, 6 );
Source Code
1do_action( 'gform_post_payment_transaction', $txn_id, $entry_id, $transaction_type, $transaction_id, $amount, $is_recurring );
This action hook is located in GFPaymentAddOn::insert_transaction() in includes/addon/class-gf-payment-addon.php.

gform_post_payment_status

gform_post_payment_status

DescriptionUsageParametersExamplesPlacementSource Code

Description
This hook is fired after an entry』s payment status has been updated and the payment was for the PayPal Standard Add-on.
Usage
1add_action( 'gform_post_payment_status', 'your_function_name', 10, 8 );

Parameters

$feed Feed Object
The PayPal configuration feed used to generate the transaction.

$entry Entry Object
The entry from which the transaction was originally generated.

$status string
The new payment status for this transaction.

$transaction_id string
The PayPal transaction ID for this transaction.

$subscriber_id integer
The PayPal subscriber ID for this transaction. Will be empty if the transaction is a one-time payment.

$amount float
The amount of the transaction.

$pending_reason string
If the payment status is set to 「Pending」, the reason will be passed in this variable.

$reason string
If the payment status is set to 「Reversed」, 「Refunded」, or 「Canceled_Reversal」 the reason for this change will be provided in this variable.

Examples
This example shows how to notify the site admin when a payment is completed or a special case.
123456789101112add_action( 'gform_post_payment_status', 'admin_payment_notification', 10, 8 );function admin_payment_notification( $feed, $entry, $status,  $transaction_id, $subscriber_id, $amount, $pending_reason, $reason ) {     $admin_email = get_bloginfo( 'admin_email' );     if ( $status == 'Completed' ) {        wp_mail( $admin_email, 'Payment Successful!', 'Message about the successful payment' );    } elseif( $status == 'Refunded' || $status == 'Reversed' || $status 'Canceled_Reversal' ) {        wp_mail( $admin_email, "Payment $status", "There was an issue with this payment: $reason" );    } }
Placement
This code should be placed in the functions.php file of your active theme.
Source Code
1do_action( 'gform_post_payment_status', $feed, $entry, $status, $transaction_id, $subscriber_id, $amount, $pending_reason, $reason )
This hook is located in GFPayPal::post_callback() in class-gf-paypal.php.

gform_post_payment_refunded

gform_post_payment_refunded

DescriptionUsageParametersExamplesSource Code

Description
The 「gform_post_payment_refunded」 action in Gravity Forms is triggered after a payment is refunded, allowing further actions to be taken.
Usage
add_action( 'gform_post_payment_refunded', 'my_function', 10, 2 );

Parameters

$entry Entry Object
The entry object that was created.

$action array
The action that occurred. Contains things such as the amount, what occurred, and the transaction ID.
$action = array(
'type' => '',
'amount' => '',
'transaction_type' => '',
'transaction_id' => '',
'subscription_id' => '',
'entry_id' => '',
'payment_status' => '',
'note' => '',
);

Examples
function my_function() {
//Do something here
}
add_action( 'gform_post_payment_refunded', 'my_function', 10, 2 );

Source Code
do_action( 'gform_post_payment_refunded', $entry, $action );
This action hook is located in GFPaymentAddOn::refund_payment() in includes/addon/class-gf-payment-addon.php.

gform_post_payment_completed

gform_post_payment_completed

DescriptionUsageParametersExamplesSource Code

Description
Triggers when a payment has been completed through the form.
Usage
1add_action( 'gform_post_payment_completed', 'my_function', 10, 2 );

Parameters

$entry Entry Object
The entry object that was created.

$action array
The action that occurred. Contains things such as the amount, what occurred, and the transaction ID.
12345678910$action = array(    'type'             => '',    'amount'           => '',    'transaction_type' => '',    'transaction_id'   => '',    'subscription_id'  => '',    'entry_id'         => '',    'payment_status'   => '',    'note'             => '',);

Examples
1234function my_function() {    //Do something here}add_action( 'gform_post_payment_completed', 'my_function', 10, 2 );
Source Code
1do_action( 'gform_post_payment_completed', $entry, $action );
This action hook is located in GFPaymentAddOn::complete_payment() in includes/addon/class-gf-payment-addon.php.

gform_post_payment_callback

gform_post_payment_callback

DescriptionUsageParametersExamplesSource Code

Description
Triggers right after the payment callback occurs when payments are processed.
Usage
1add_action( 'gform_post_payment_callback', 'my_function', 10, 3 );

Parameters

$entry Entry Object
The entry object that was created.

$action array
The action that occurred. Contains things such as the amount, what occurred, and the transaction ID.
12345678910$action = array(    'type'             => '',    'amount'           => '',    'transaction_type' => '',    'transaction_id'   => '',    'subscription_id'  => '',    'entry_id'         => '',    'payment_status'   => '',    'note'             => '',);

$result Mixed
The result of the payment, such as payment success or failure.

Examples
1234function my_function() {    //Do something here}add_action( 'gform_post_payment_callback', 'my_function', 10, 3 );
Source Code
1do_action( 'gform_post_payment_callback', $entry, $action, $result );
This action hook is located in GFPaymentAddOn::process_callback_action() in includes/addon/class-gf-payment-addon.php.

gform_post_payment_action

gform_post_payment_action

DescriptionUsageParametersExamples1. Send event notificationPlacementSource CodeSince

Description
This action hook can be used to perform custom actions after processing of the following payment events has occurred:

complete_payment
refund_payment
fail_payment
add_pending_payment
void_authorization
create_subscription
cancel_subscription
expire_subscription
add_subscription_payment
fail_subscription_payment
fail_create_subscription

Usage
This action hook, which would run for all payment add-on feeds, can be used like so:
1add_action( 'gform_post_payment_action', 'your_function_name', 10, 4 );

Parameters

$entry Entry Object
The entry for which the payment event occurred.

$action array
An associative array containing the event details.
12345678910$action = array(    'type'             => '',    'amount'           => '',    'transaction_type' => '',    'transaction_id'   => '',    'subscription_id'  => '',    'entry_id'         => '',    'payment_status'   => '',    'note'             => '',);

Examples
1. Send event notification
The following example shows how you can trigger the sending of form notifications registered for the event. See the Send Notifications On Payment Events article for a more detailed tutorial.
1234add_action( 'gform_post_payment_action', function ( $entry, $action ) {    $form = GFAPI::get_form( $entry['form_id'] );    GFAPI::send_notifications( $form, $entry, rgar( $action, 'type' ) );}, 10, 2 );
Placement
Your code snippet should be placed in the functions.php file of your active theme.
Source Code
1do_action( 'gform_post_payment_action', $entry, $action );
This action hook is located in GFPaymentAddOn::post_payment_action() in includes/addon/class-gf-payment-addon.php.
Since
This filter was added in Gravity Forms 1.9.10.21.

gform_post_paging

gform_post_paging

DescriptionUsageParametersExamplePlacementSource Code

Description
Use this hook to perform actions after going to the next or previous page on a multi-page form.
Usage
add_action( 'gform_post_paging', 'set_default_value', 10, 3 );

You can also specify this per form by adding the form id after the hook name.
add_action( 'gform_post_paging_1', 'set_default_value', 10, 3 );

Parameters

$form Form Object
Current form.

$source_page_number integer
Number of page user is coming from.

$current_page_number integer
Current page number.

Example
This example shows how you can use javascript to display a message to the screen when on page two.
add_action( 'gform_post_paging', 'alert_user', 10, 3 );
function alert_user( $form, $source_page_number, $current_page_number ) {
if ( $current_page_number == 2 ) {
echo '';
}
}

Placement
This code should be placed in the functions.php file of your active theme.
Source Code
This action hook is located in GFFormDisplay::get_form() in form_display.php.

gform_post_notification_save

gform_post_notification_save

DescriptionUsageParametersExamplePlacementSinceSource Code

Description

Fires after the notification is successfully saved.

Usage

add_action( 'gform_post_notification_save','your_function_name', 10,3 );

Parameters

$notification Notifications Object
The notifications object.

$form Form Object
The current form.

$is_new_notification bool
True if this is a new notification. False otherwise.

Example

add_action( 'gform_post_notification_save','notification_saved', 10,3 );
function notification_saved( $notification, $form, $is_new_notification ){
if ( $is_new_notification ) {
$message = 'A new notification was created for form id ' . $form['id'] . ' - ' . $form['title'];
}
else{
$message = 'A new notification was updated for form id ' . $form['id'] . ' - ' . $form['title'];
}
GFCommon::send_email( '[email protected]', '[email protected]','','','New Notification', $message );
}

Placement

This code should be placed in the functions.php file of your active theme.

Since

This filter was added in Gravity Forms version 1.9.16.

Source Code

This filter is located in GFNotification::notification_edit_page() in notification.php.

gform_post_note_added

gform_post_note_added

DescriptionUsageParametersExamplesSend notifications configured for the custom event note_addedSource Code

Description
The 「gform_post_note_added」 action is triggered after a note is added to an entry in Gravity Forms, allowing further actions to be performed.
Usage
1add_action( 'gform_post_note_added', 'my_function', 10, 6 );

Parameters

$insert_id int
The ID generated from the auto incremented column within the database. See $wpdb->insert.

$entry_id int
The ID of the entry that the note is being added to.

$user_id int
The user that is adding the note.

$user_name string
The name of the user that created the note.

$note string
The content of the note being added.

$note_type string
The type associated with the note.

Examples
Send notifications configured for the custom event note_added
The following example assumes you have already added a custom notification event with the filter gform_notification_events defined as 『note_added』. It will check if there』s any active notification configured for that event, and process them if any.
12345678910111213141516171819202122add_action( 'gform_post_note_added', 'send_note_added_notifications', 10, 2 ); function send_note_added_notifications( $insert_id, $entry_id ) {     GFCommon::log_debug( __METHOD__ . "(): Running for entry id {$entry_id}" );       $entry = GFAPI::get_entry( $entry_id );    $form_id = rgar( $entry, 'form_id' );    $form = GFAPI::get_form( $form_id );     // Replace note_added with the name you have used to define your event    $event = 'note_added';     $notifications_to_send = GFCommon::get_notifications_to_send( $event, $form, $entry );     $log_notification_event = empty( $notifications_to_send ) ? 'No notifications to process' : 'Processing notifications';    GFCommon::log_debug( "GFFormDisplay::process_form(): {$log_notification_event} for {$event} event." );           if ( ! empty ( $notifications_to_send ) ) {        GFAPI::send_notifications( $form, $entry, $event );     }}
Source Code
This action hook is located in forms_model.php.