gform_entry_created

gform_entry_created

DescriptionUsageParametersExamples1. Add a value to the entry meta.2. Delete an entry propertySource Code

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
1add_action( 'gform_entry_created', 'your_function_name', 10, 2 );

Parameters

$entry Entry Object
The entry that was just created.

$form Form Object
The current form.

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.
123456789101112131415add_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.
123add_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.

发表回复

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