gform_pre_form_editor_save

gform_pre_form_editor_save

DescriptionUsageParametersExamplesSource Code

Description
This filter fires on the Form Editor page when a form is saved.
Usage
123456789

Parameters

form array
The current form object.

Examples
This example uses the gform_admin_pre_render filter to load the hook and changed the form title to 「Testing…」.
12345678910111213141516add_action( 'gform_admin_pre_render', 'pre_render_function' );function pre_render_function( $form ) {    ?>        

gform_pre_entry_list

gform_pre_entry_list

DescriptionUsageParametersExampleSource CodeSince

Description
This hook fires before the entry list content is generated. Echoed content would appear above the page title.
Usage
The following would run for all forms:
add_action( 'gform_pre_entry_list', 'your_function_name' );

Parameters

$form_id integer
The ID of the form the entry list is being displayed for.

Example
add_action( 'gform_pre_entry_list', 'echo_content' );
function echo_content( $form_id ) {
echo 'some content here';
}

Source Code
do_action( 'gform_pre_entry_list', $form_id );
This hook is located in GFEntryList::all_leads_page() in entry_list.php.
Since
This hook was added in Gravity Forms 1.9.13.21.

gform_pre_entry_detail

gform_pre_entry_detail

DescriptionUsageParametersExamplePlacementSinceSource Code

Description
Fires before the entry detail page is displayed.
Usage
add_action( 'gform_pre_entry_detail', 'your_function_name', 10, 2 );

Parameters

$form Form Object
The current form.

$entry Entry Object
The current entry.

Example
add_action( 'gform_pre_entry_detail', 'mark_entry_read', 10, 2 );
function mark_entry_read( $form, $entry ){
echo 'Hello, World!';
}

Placement
This code should be placed in the functions.php file of your active theme.
Since
This action was added in Gravity Forms version 2.3.3.9.
Source Code
This action is located in GFEntryDetail::lead_detail_page in entry_detail.php.

gform_pre_delete_feed

gform_pre_delete_feed

DescriptionUsageParametersExamples1. Get feed before it is deletedSource CodeSince

Description
The gform_pre_delete_feed hook can be used to perform a custom action just before a feed is deleted from the database.
Usage
The hook which would run for all add-ons would be used like so:
1add_action( 'gform_pre_delete_feed', 'your_function_name', 10, 2 );
You can target a specific add-on with the following variation of this hook:
1add_action( 'gform_{SHORT_SLUG}_pre_delete_feed', 'your_function_name', 10, 2 );
See the Gravity Forms Add-On Slugs article for a list of possible short slugs.

Parameters

$id int
The ID of the feed being deleted.

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

Examples
1. Get feed before it is deleted
12345add_action( 'gform_pre_delete_feed', 'pre_delete_feed', 10, 2 );function pre_delete_feed( $id, $addon ) {    $feed = $addon->get_feed( $id );    // Do something with the $feed.}
Source Code
This action hook is located in GFFeedAddOn::delete_feed() in /includes/addons/class-gf-feed-addon.php.
Since
This hook was added in Gravity Forms 2.4.20.4

gform_pre_confirmation_save

gform_pre_confirmation_save

DescriptionUsageParametersExamplesSource Code

Description
Modify the confirmation object before it is saved to the database. This is particularly useful when saving custom confirmation settings to the confirmation object.
Usage
Apply to all forms:
1add_filter( 'gform_pre_confirmation_save', 'my_custom_function', 10, 2 );
Apply to a specific form ID:
1add_filter( 'gform_pre_confirmation_save_5', 'my_custom_function', 10, 2 );
Parameters

$confirmation Confirmation Object
The confirmation object about to be saved.

$form Form Object
The current form object to which the confirmation being saved belongs.

Examples
This example demonstrates how you can add the value entered via our gform_confirmation_ui_settings to the confirmation object before it is saved to the database. Use with the gform_confirmation_ui_settings hook to display your custom settings UI.
If your UI settings have a 「name」 attribute, they will be submitted along with the rest of the default confirmation settings. We can then retrieve our custom value from the $_POST using the Gravity Forms helper function rgpost().
12345add_filter( 'gform_pre_confirmation_save', 'my_custom_confirmation_save', 10, 2 );function my_custom_confirmation_save( $confirmation, $form ) {    $confirmation['my_custom_setting'] = rgpost( 'my_custom_setting' );    return $confirmation;}
Source Code
This filter is located in GFFormSettings::handle_confirmation_edit_submission() in form_settings.php.

gform_pre_confirmation_deleted

gform_pre_confirmation_deleted

DescriptionUsageParametersExamplesSource Code

Description
Triggered immediately before the form deletion confirmation appears.
Usage
1add_action( 'gform_pre_confirmation_deleted', 'my_function', 10, 2 );

Parameters

$id int
The ID of the confirmation being deleted.

$form array
The ID of the form that the confirmation is being deleted from.

Examples
12345add_action( 'gform_pre_confirmation_deleted', 'my_pre_confirmation_deleted_func' 10, 2); function my_pre_confirmation_deleted_func( $confirmation_id, $form ) {  // perform action before a confirmation is deleted}
Source Code
This action hook is located in preview.php.

gform_ppcp_webhook

gform_ppcp_webhook

DescriptionUsageParametersExamples1. Add a notePlacementSource Code

Description
The gform_ppcp_webhook filter can be used to customize the webhook events processed by the Gravity Forms PayPal Checkout Add-On. The following event types are supported by default:

PAYMENT.CAPTURE.REFUNDED
PAYMENT.AUTHORIZATION.VOIDED
PAYMENT.CAPTURE.COMPLETED
PAYMENT.CAPTURE.DENIED

See the PayPal API Reference for a full list of event types for which webhooks can be sent.
Usage
The hook which would run for all PayPal Checkout feeds can be used like so:
add_filter( 'gform_ppcp_webhook', 'your_function_name', 10, 2 );

Parameters

$action array
An associative array containing the event details or an empty array for unsupported event types.
array(
'type' => '',
'amount' => '',
'transaction_type' => '',
'transaction_id' => '',
'subscription_id' => '',
'entry_id' => '',
'payment_status' => '',
'note' => '',
);

$event array
The PayPal Checkout event object for the webhook which was received. See the PayPal API Reference for details about the event properties.

Examples
1. Add a note
The following shows how you can add a custom note when an authorization is cancelled (voided).
add_filter( 'gform_ppcp_webhook', 'ppcp_webhook_action_note', 10, 2 );
function ppcp_webhook_action_note( $action, $event ) {
if ( rgar( $action, 'type' ) === 'PAYMENT.AUTHORIZATION.VOIDED' ) {
$action['note'] = sprintf( 'Authorization has been cancelled (voided). Transaction Id: %s', rgar( $action, 'transaction_id' ) );
}

return $action;
}

Placement
Your code snippet should be placed in the functions.php file of your active theme.
Source Code
$action = apply_filters( 'gform_ppcp_webhook', $action, $event );

This hook is located in GF_PPCP::callback() in class-gf-ppcp.php.

gform_ppcp_object

gform_ppcp_object

DescriptionUsageParametersExamplePlacementSource Code

Description
The gform_ppcp_object filter can be used to customize the GFPPCP object that is included in the form initialization scripts for the PayPal Field which is available with the PayPal Checkout Add-On.
Usage
The following would apply to all forms:
add_filter( 'gform_ppcp_object', 'your_function_name', 10, 2 );

Parameters

$args array
An array of arguments which control the appearance and behaviour of the PayPal Checkout and Credit Card field. Example:
array(
'formId' => 1,
'isAjax' => false,
'currency' => 'USD',
'feeds' => array(),
'smartPaymentButtons' => array(
'buttonsLayout' => 'vertical',
'buttonsSize' => 'responsive',
'buttonsShape' => 'rect',
'buttonsColor' => 'gold',
),
'ccFieldID' => 4,
'ccPage' => 1,
'paymentMethods' => array(
array( 'text' => 'PayPal Checkout', 'value' => 'PayPal Checkout' ),
array( 'text' => 'Credit Card', 'value' => 'Credit Card' )
),
'cardStyle' => array(),
);

$form_id int
The ID of the form containing the PayPal Field being prepared for display.

Example
This example shows how you can change the PayPal Smart Payment Buttons shape.
add_filter( 'gform_ppcp_object', 'ppcp_object_buttons_shape', 10, 2 );
function ppcp_object_buttons_shape( $args, $form_id ) {
$args['smartPaymentButtons']['buttonsShape'] = 'pill';
return $args;
}

Placement
This code should be placed in the functions.php file of your active theme.
Source Code
$args = apply_filters( 'gform_ppcp_object', $args, $form['id'] );

This filter is located in GF_PPCP::register_init_scripts() in class-gf-ppcp.php.

gform_ppcp_intent

gform_ppcp_intent

DescriptionUsageParametersExamplesPlacementSource Code

Description
The 「gform_ppcp_intent」 filter in the Gravity Forms PayPal Checkout Add-On allows the payment intent to be overridden.
Usage
1add_filter( 'gform_ppcp_intent', 'your_function_name', 10, 3 );

Parameters

$intent string
The payment intent. Default is capture. Possible values: capture or authorize.

$form_id int
The ID of the current form.

$feed_id int
The ID of the current feed.

Examples
1234add_filter( 'gform_ppcp_intent', 'change_intent', 10, 3 );function change_intent( $intent, $form_id, $feed_id ) {    return 'authorize';}
Placement
This code should be placed in the functions.php file of your active theme.
Source Code
1return apply_filters( 'gform_ppcp_intent', 'capture', $form_id, $feed_id );
This filter is located in GF_PPCP::get_intent() in class-gf-ppcp.php.

gform_ppcp_entry_not_found_status_code

gform_ppcp_entry_not_found_status_code

DescriptionUsageParametersExamplesPlacementSource Code

Description
The 「gform_ppcp_entry_not_found_status_code」 filter in the Gravity Forms PayPal Checkout Add-On allows the status code for the entry not found WP_Error to be overridden.
Usage
add_filter( 'gform_ppcp_entry_not_found_status_code', 'your_function_name', 10, 3 );

Parameters

$status_code int
The status code. Default is 200.

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

$event array
The PayPal event object for the webhook which was received. See the PayPal API Reference for details about the event properties.

Examples
add_filter( 'gform_ppcp_entry_not_found_status_code', 'change_status_code', 10, 3 );
function change_status_code( $status_code, $action, $event ) {
return '205';
}

Placement
This code should be placed in the functions.php file of your active theme.
Source Code
This filter is located in GF_PPCP::get_entry_not_found_wp_error() in gravityformsstripe/class-gf-ppcp.php.