gform_post_multifile_upload

gform_post_multifile_upload

DescriptionUsageParametersExamplesPlacementSource Code

Description
The 「gform_post_multifile_upload」 action in Gravity Forms allows further actions to be performed after multiple files have been uploaded.
Usage
The following would apply to all forms:
1add_action( 'gform_post_multifile_upload', 'your_function_name', 10, 5 );
To target a specific form, append the form id to the hook name. (format: gform_post_multifile_upload_FORMID)
1add_action( 'gform_post_multifile_upload_2', 'your_function_name', 10, 5 );

Parameters

$form Form Object
The form object.

$field Field Object
The field object.

$uploaded_filename string
The name of the file uploaded.

$tmp_file_name string
The temporary name of the file while it was uploaded.

$file_path string
The path where the file is uploaded.

Examples
1234567add_action( 'gform_post_multifile_upload', 'upload_alert', 10, 5 );function upload_alert( $form, $field, $uploaded_filename, $tmp_file_name, $file_path ){    $dirname = dirname( $file_path );    if ( $uploaded_filename == '600x500.png' ){        copy( $file_path,  $dirname . 'backup_' . $uploaded_filename );    }}
Placement
This code should be placed in the functions.php file of your active theme.
Source Code
This filter is located in GFAsyncUpload::upload() in upload.php.

gform_post_form_views_deleted

gform_post_form_views_deleted

DescriptionUsageParametersExamplesSource Code

Description
The 「gform_post_form_views_deleted」 action is triggered when a form view count has been reset to zero, allowing further actions to be performed.
Usage
1add_action( 'gform_post_form_views_deleted', 'my_function', 10, 1 );

Parameters

$form_id int
The ID of the form that the view count is being reset on.

Examples
1234add_action( 'gform_post_form_views_deleted', 'my_function', 10, 1 );function my_function( $form_id ) {  // perform action after the form view count has been reset to zero}
Source Code
This action hook is located in forms_model.php.

gform_post_form_trashed

gform_post_form_trashed

DescriptionUsageParametersExamplesSource Code

Description
The 「gform_post_form_trashed」 action is triggered after a form is moved to trash in Gravity Forms, allowing further actions to be performed.
Usage
1add_action( 'gform_post_form_trashed', 'my_function', 10, 1 );

Parameters

$form_id int
The ID of the form being moved to trash.

Examples
12345add_action( 'gform_post_form_trashed', 'my_post_form_trashed_func', 10); function my_post_form_trashed_func( $form_id ) {  // perform action after a form has been moved to the trash}
Source Code
This action hook is located in forms_model.php.

gform_post_form_restored

gform_post_form_restored

DescriptionUsageParametersExamplesSource Code

Description
The 「gform_post_form_restored」 action in Gravity Forms is triggered after a form is restored from the trash, allowing further actions to be performed.
Usage
add_action( 'gform_post_form_restored', 'my_function', 10 );

Parameters

$form_id int
The ID of the form being restored.

Examples
add_action( 'gform_post_form_restored', 'my_post_form_restored_func', 10);

function my_post_form_restored_func( $form_id ) {
// perform action after a form has been restored
}

Source Code
This action hook is located in forms_model.php.

gform_post_form_duplicated

gform_post_form_duplicated

DescriptionUsageParametersExamplesSource Code

Note: This hook replaces the deprecated 「gform_after_duplicate_form」 hook.
Description
The 「gform_post_form_duplicated」 action in Gravity Forms is triggered after a form is duplicated, allowing further actions to be performed. The hook provides the ID of the form duplicated and the ID of the new form created.
Usage
add_action( 'gform_post_form_duplicated', 'my_function', 10, 2 );

Parameters

$form_id int
The ID of the form being duplicated.

$new_id int
The ID of the newly created, duplicate form.

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

Source Code
This action hook is located in GFFormsModel::duplicate_form() in forms_model.php.

gform_post_form_deactivated

gform_post_form_deactivated

DescriptionUsageParametersExamplesSource Code

Description
The 「gform_post_form_deactivated」 action in Gravity Forms is triggered after an active form is marked as inactive, allowing further actions to be performed.
Usage
add_action( 'gform_post_form_deactivated', 'my_function', 10, 1 );

Parameters

$form_id int
The ID of the form that is being marked as inactive.

Examples
add_action( 'gform_post_form_deactivated', 'my_post_form_deactivated_func', 10);

function my_post_form_deactivated_func( $form_id ) {
// perform action after a form has been deactivated
}

Source Code
This action hook is located in forms_model.php.

gform_post_form_activated

gform_post_form_activated

DescriptionUsageParametersExamplesSource Code

Description
The 「gform_post_form_activated」 action in Gravity Forms is triggered after an inactive form is marked as active, allowing further actions to be performed.
Usage
add_action( 'gform_post_form_activated', 'my_function', 10, 2 );

Parameters

$form_id int
The ID of the form that is being marked as active.

Examples
add_action( 'gform_post_form_activated', 'my_post_form_activated_func', 10);

function my_post_form_activated_func( $form_id ) {
// perform action after a form has been activated
}

Source Code
This action hook is located in forms_model.php.

gform_post_fail_subscription_payment

gform_post_fail_subscription_payment

DescriptionUsageParametersExamples1. Basic Usage2. Update User RoleSource Code

Description
Triggered after an existing subscription payment fails.
Usage
1add_action( 'gform_post_fail_subscription_payment', 'my_function', 10, 2 );

Parameters

$entry Entry Object
The entry object that was created,

$action array
The action that occurred within the subscription payment. Contains further information about the subscription.
12345678910$action = array(    'type'             => '',    'amount'           => '',    'transaction_type' => '',    'transaction_id'   => '',    'subscription_id'  => '',    'entry_id'         => '',    'payment_status'   => '',    'note'             => '',);

Examples
1. Basic Usage
1234function my_function() {    //Do something here}add_action( 'gform_post_fail_subscription_payment', 'my_function', 10, 2 );
2. Update User Role
1234567891011add_action( 'gform_post_fail_subscription_payment', 'update_user_role' );function update_user_role( $entry ) {    if ( function_exists( 'gf_user_registration' ) ) {        // use WP_User to change role - https://developer.wordpress.org/reference/classes/wp_user/        $user = gf_user_registration()->get_user_by_entry_id( $entry['id'] );        if ( is_object( $user ) ) {            $user->remove_role( 'role_one' );            $user->add_role( 'role_two' );        }    }}
Source Code
1do_action( 'gform_post_fail_subscription_payment', $entry, $action );
This action hook is located in GFPaymentAddOn::fail_subscription_payment() in includes/addon/class-gf-payment-addon.php.

gform_post_export_entries

gform_post_export_entries

DescriptionUsageParametersExamples1. Basic usage2. Append additional entriesSinceSource Code

Description
Triggered after exporting entries from a form, allowing further actions to be performed.
Usage
1add_action( 'gform_post_export_entries', 'my_function', 10, 5 );

Parameters

$form array
The form object to get the entries from.

$start_date string
The start date from where the entries exported will begin.

$end_date string
The end date on which the entry export will stop.

$array array
The field IDs from which entries are being exported.

$export_id string
The unique ID for the export. Since version 2.4.6.

Examples
1. Basic usage
1234function my_function() {    //Do something here}add_action( 'gform_post_export_entries', 'my_function', 10, 5 );
2. Append additional entries
The following shows how additional entries can be appended to the entry export when using Gravity Forms 2.4.6 or greater.
12345678910111213141516add_action( 'gform_post_export_entries', function ( $form, $start_date, $end_date, $fields, $export_id ) {    $entries = array(); // Define or get the additional entries here.     $lines   = '';     foreach ( $entries as $entry ) {        $lines .= GFExport::get_entry_export_line( $entry, $form, $fields, array(), ',' );        $lines .= "n";    }     if ( ! seems_utf8( $lines ) ) {        $lines = utf8_encode( $lines );    }     GFExport::write_file( $lines, $export_id );}, 10, 5 );
Since
This filter was added in Gravity Forms version 1.9.3.
Added the 「export_id」 parameter in version 2.4.6.
Source Code
This action hook is located in export.php.

gform_post_entry_list

gform_post_entry_list

DescriptionUsageParametersExampleSource CodeSince

Description
This hook fires after the entry list content is generated. Echoed content would appear after the bulk actions/paging links below the entry list table.
Usage
The following would run for all forms:
1add_action( 'gform_post_entry_list', 'your_function_name' );

Parameters

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

Example
1234add_action( 'gform_post_entry_list', 'echo_content' );function echo_content( $form_id ) {    echo 'some content here';}
Source Code
1do_action( 'gform_post_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.