gform_entry_created

Description

This hook fires after the lead has been created but before the post has been created, notifications have been sent, and the confirmation has been processed.

Usage

add_action( 'gform_entry_created', 'your_function_name', 10, 2 );

Parameters

Examples

1. Add a value to the entry meta.

This example demonstrates how to use to the gform_entry_created hook to populate a value in the entry’s entry meta. It is possible to populate the entry meta anywhere you have the entry ID; however, let’s assume that we’re going to retrieve this entry meta and replace a gform_custom_merge_tags.

add_action( 'gform_entry_created', 'generate_mergedoc' );
function generate_mergedoc( $entry, $form ) {

    $feed = self::get_mergedoc_feeds( $form['id'] );

    if ( empty( $feed ) || ! rgar( $feed, 'active' ) || ! $entry )
        return;

    // get download link
    $download_link = self::get_download_link( $uid );

    // update entry meta
    gform_update_meta( $entry['id'], 'gfmergedoc_download_link', $download_link );

}

2. Delete an entry property

The following example shows how you can delete an entry property such as the user agent from the database.

add_action( 'gform_entry_created', function( $entry ) {
    GFAPI::update_entry_property( $entry['id'], 'user_agent', '' );
} );

Source Code

This filter is located in GFFormDisplay::handle_submission() in form_display.php.