gform_entry_detail_url

gform_entry_detail_url

DescriptionUsageParametersExample(s)PlacementSinceSource Code

Description
The 「gform_entry_detail_url」 filter in Gravity Forms allows the entry_url placeholder to be modified to handle situations in which the wpurl might not match the admin_url.
Usage
1add_filter( 'gform_entry_detail_url', 'your_function_name', 10, 3 );

Parameters

$entry_url string
The Entry URL to filter.

$form Form Object
The current form object.

$entry Entry Object
The current entry object.

Example(s)
12345add_filter( 'gform_entry_detail_url', 'filter_url', 10, 3 );function filter_url( $entry_url, $form, $entry ){    $entry_url = str_replace('http://localhost', 'http://rocketgenius.com', $entry_url );    return $entry_url;}
Placement
Your code snippet should be placed in the functions.php file of your active theme.
Since
Gravity Forms Version 2.2.4
Source Code
This filter is located in GFCommon:replace_variables() in gravityforms/common.php.

gform_entry_detail_title

gform_entry_detail_title

DescriptionUsageParametersExampleSource Code

Description
The 「gform_entry_detail_title」 filter in Gravity Forms allows the title displayed on the entry detail page to be modified.
Usage
add_filter( 'gform_entry_detail_title', 'my_function_call' );

Parameters

$title string
The title used.

$form array
The form object.

$entry array
The entry object

Example
add_filter( 'gform_entry_detail_title', function( $title, $form, $entry ) {
return 'Your new title for entry #' . $entry['id'];
}, 10, 3 );

Source Code
This filter is located in entry_detail.php.

gform_entry_detail_sidebar_middle

gform_entry_detail_sidebar_middle

DescriptionUsageParametersExamplesPlacementSource Code

Description
Use this action hook to add extra content to the sidebar. In Gravity Forms 1.9 and earlier, the content would be displayed before the Notifications box (if visible). In Gravity Forms 2.0+, the content is displayed after the meta boxes but before the print button.
Note: To add custom meta boxes to the sidebar, we recommend using the gform_entry_detail_meta_boxes filter.
Usage
add_action( 'gform_entry_detail_sidebar_middle', 'add_sidebar_text_middle', 10, 2 );

Parameters

$form Form Object
The form from which the entry value was submitted.

$entry Entry Object
The current entry.

Examples
This example adds a new box with a header and text.
add_action( 'gform_entry_detail_sidebar_middle', 'add_sidebar_text_middle', 10, 2 );
function add_sidebar_text_middle( $form, $entry ) {
echo "

Stuff in the Middle

text added in the middle!

";
}

Placement
This code should be placed in the functions.php file of your active theme.
Source Code
This filter is located in GFEntryDetail::lead_detail_page() in entry_detail.php.

gform_entry_detail_sidebar_before

gform_entry_detail_sidebar_before

DescriptionUsageParametersExamplesPlacementSource Code

Description
Use this action hook to add extra text/boxes before the first box in the Entry detail sidebar.
Usage
add_action( 'gform_entry_detail_sidebar_before', 'add_sidebar_text_before', 10, 2 );

Parameters

$form Form Object
The form from which the entry value was submitted.

$entry Entry Object
The current entry.

Examples
This example adds a new box with a header and text.
add_action( 'gform_entry_detail_sidebar_before', 'add_sidebar_text_before', 10, 2 );
function add_sidebar_text_before( $form, $entry ) {
echo "

Extra Cool Stuff

text added before!

";
}

Placement
This code should be placed in the functions.php file of your active theme.
Source Code
This filter is located in GFEntryDetail::lead_detail_page() in entry_detail.php.

gform_entry_detail_sidebar_after

gform_entry_detail_sidebar_after

DescriptionUsageParametersExamplesPlacementSource Code

Description
Use this action hook to add extra text/boxes after the last box in the Entry detail sidebar.
Usage
1add_action( 'gform_entry_detail_sidebar_after', 'add_sidebar_text_after', 10, 2 );

Parameters

$form Form Object
The form from which the entry value was submitted.

$entry Entry Object
The current entry.

Examples
This example adds a new box with a header and text.
1234add_action( 'gform_entry_detail_sidebar_after', 'add_sidebar_text_after', 10, 2 );function add_sidebar_text_after( $form, $entry ) {    echo "

More Cool Stuff

text added after!

";}
Placement
This code should be placed in the functions.php file of your active theme.
Source Code
This filter is located in GFEntryDetail::lead_detail_page() in entry_detail.php.

gform_entry_detail_meta_boxes

gform_entry_detail_meta_boxes

DescriptionUsageParametersExamples1. Enable the Payment Details2. User Registration Add-On3. Partial Entries Add-OnPlacementSource CodeSince

Description
The gform_entry_detail_meta_boxes filter can be used to add custom meta boxes to the entry detail page.
Usage
add_filter( 'gform_entry_detail_meta_boxes', 'your_function_name', 10, 3 );

Parameters

$meta_boxes array
The properties for the meta boxes. The default array is defined like so:
$meta_boxes = array(
'submitdiv' => array(
'title' => esc_html__( 'Entry', 'gravityforms' ),
'callback' => array( 'GFEntryDetail', 'meta_box_entry_info' ),
'context' => 'side',
),
'notifications' => array(
'title' => esc_html__( 'Notifications', 'gravityforms' ),
'callback' => array( 'GFEntryDetail', 'meta_box_notifications' ),
'context' => 'side',
),
);

If the user has the gravityforms_view_entry_notes capability then it will also contain the following:
$meta_boxes['notes'] = array(
'title' => esc_html__( 'Notes', 'gravityforms' ),
'callback' => array( 'GFEntryDetail', 'meta_box_notes' ),
'context' => 'normal',
);

If the entry has been processed by a payment add-on and the payment_status property is not empty then it will also contain the following:
$meta_boxes['payment'] = array(
'title' => $entry['transaction_type'] == 2 ? esc_html__( 'Subscription Details', 'gravityforms' ) : esc_html__( 'Payment Details', 'gravityforms' ),
'callback' => array( 'GFEntryDetail', 'meta_box_payment_details' ),
'context' => 'side',
'callback_args' => array( $entry, $form ),
);

$entry Entry Object
The entry currently being viewed/edited.

$form Form Object
The form object used to process the current entry.

Examples
1. Enable the Payment Details
This example shows how you can enable the payment details panel when the form isn』t being used with a payment add-on.
add_filter( 'gform_entry_detail_meta_boxes', 'add_payment_details_meta_box', 10, 3 );
function add_payment_details_meta_box( $meta_boxes, $entry, $form ) {
if ( ! isset( $meta_boxes['payment'] ) ) {
$meta_boxes['payment'] = array(
'title' => esc_html__( 'Payment Details', 'gravityforms' ),
'callback' => array( 'GFEntryDetail', 'meta_box_payment_details' ),
'context' => 'side',
'callback_args' => array( $entry, $form ),
);
}

return $meta_boxes;
}

2. User Registration Add-On
This example shows how you can add a meta box to the entry detail page to display the details of the user which was created from the entry. If a user does not exist for the entry it will show a button enabling feed processing to be triggered.
/**
* Add the meta box to the entry detail page.
*
* @param array $meta_boxes The properties for the meta boxes.
* @param array $entry The entry currently being viewed/edited.
* @param array $form The form object used to process the current entry.
*
* @return array
*/
function register_ur_meta_box( $meta_boxes, $entry, $form ) {
// If the add-on is active and the form has an active feed, add the meta box.
if ( function_exists( 'gf_user_registration' ) && gf_user_registration()->get_active_feeds( $form['id'] ) ) {
if ( gf_pending_activations()->is_entry_pending_activation( $entry ) ) {
return $meta_boxes;
}

$meta_boxes[ 'gf_user_registration' ] = array(
'title' => 'User Registration',
'callback' => 'add_ur_details_meta_box',
'context' => 'side',
);
}

return $meta_boxes;
}
add_filter( 'gform_entry_detail_meta_boxes', 'register_ur_meta_box', 10, 3 );

/**
* The callback used to echo the content to the meta box.
*
* @param array $args An array containing the form and entry objects.
*/
function add_ur_details_meta_box( $args ) {

$form = $args['form'];
$entry = $args['entry'];

$html = '';
$action = 'gf_user_registration_process_feeds';

// Retrieve the user from the current entry, if available.
$user = gf_user_registration()->get_user_by_entry_id( $entry['id'] );

if ( ! $user && rgpost( 'action' ) == $action ) {
check_admin_referer( 'gforms_save_entry', 'gforms_save_entry' );

// Because the entry doesn't already have a user and the 'Process Feeds' button was clicked process the feeds.
gf_user_registration()->maybe_process_feed( $entry, $form );

// Retrieve the user
$user = gf_user_registration()->get_user_by_entry_id( $entry['id'] );

$html .= 'Feeds Processed.

';
}

if ( ! $user ) {

// Add the 'Process Feeds' button.
$html .= sprintf( '', 'Process Feeds', $action );

} else {

// Display some user details.
$html .= 'Username: ' . $user->user_login . '

';
$html .= 'User ID: ' . $user->ID;
}

echo $html;
}

3. Partial Entries Add-On
This example shows how you can add a meta box to the entry detail page to display a button enabaling the partial entry to be marked as completed.
/**
* Add the meta box to the entry detail page and process the complete request.
*
* @param array $meta_boxes The properties for the meta boxes.
* @param array $entry The entry currently being viewed/edited.
* @param array $form The form object used to process the current entry.
*
* @return array
*/
function register_partial_entries_box( $meta_boxes, $entry, $form ) {
if ( class_exists( 'GF_Partial_Entries' ) ) {
$add_on = GF_Partial_Entries::get_instance();

if ( ! $add_on->is_enabled( $form['id'] ) ) {
return $meta_boxes;
}

$partial_entry_id = rgar( $entry, 'partial_entry_id' );
$action = 'gf_partial_entries_complete_entry';

if ( $partial_entry_id && rgpost( 'action' ) == $action ) {
check_admin_referer( 'gforms_save_entry', 'gforms_save_entry' );

$entry_id = $entry['id'];

gform_delete_meta( $entry_id, 'partial_entry_id' );
gform_delete_meta( $entry_id, 'date_saved' );
gform_delete_meta( $entry_id, 'resume_url' );
gform_delete_meta( $entry_id, 'resume_token' );

$entry = GFAPI::get_entry( $entry_id );
GFEntryDetail::set_current_entry( $entry );

return $meta_boxes;
}

if ( $partial_entry_id ) {
$meta_boxes['gf_partial_entries'] = array(
'title' => 'Partial Entries',
'callback' => 'add_partial_entries_meta_box',
'context' => 'side',
);
}
}

return $meta_boxes;
}

add_filter( 'gform_entry_detail_meta_boxes', 'register_partial_entries_box', 10, 3 );

/**
* The callback used to echo the content to the meta box.
*
* @param array $args An array containing the form and entry objects.
*/
function add_partial_entries_meta_box( $args ) {
$action = 'gf_partial_entries_complete_entry';
$html = sprintf( '', 'Complete Entry', $action );

echo $html;
}

Placement
This code should be placed in the functions.php file of your active theme.
Source Code
This filter is located in GFEntryDetail::add_meta_boxes() in entry_detail.php.
Since
This filter was added in Gravity Forms 2.0-beta-3.

gform_entry_detail_grid_display_empty_fields

gform_entry_detail_grid_display_empty_fields

DescriptionUsageParametersExample1. Force display2. Use the cookie set by the 「show empty fields」 checkboxPlacementSource CodeSince

Description
Allow displaying empty fields on the entry detail page/print view even if option is not checked.
Usage
add_filter( 'gform_entry_detail_grid_display_empty_fields', 'your_function_name' );

Parameters

$display_empty_fields bool
Whether empty fields should be displayed.

$form Form Object
The form object the entry currently being viewed belongs to.

$entry Entry Object
The entry currently being viewed.

Example
1. Force display
add_filter( 'gform_entry_detail_grid_display_empty_fields', '__return_true' );

2. Use the cookie set by the 「show empty fields」 checkbox
This example can be used to include empty fields in the entry printout.
add_filter( 'gform_entry_detail_grid_display_empty_fields', function ( $display_empty_fields ) {
if ( ! $display_empty_fields ) {
$display_empty_fields = rgget( 'gf_display_empty_fields', $_COOKIE );
}

return $display_empty_fields;
} );

Placement
This code should be placed in the functions.php file of your active theme.
Source Code
$display_empty_fields = apply_filters( 'gform_entry_detail_grid_display_empty_fields', $display_empty_fields, $form, $lead );

This filter is located in GFEntryDetail::lead_detail_grid() in entry_detail.php.
Since
This filter was added in version 1.8.18.

gform_entry_detail_content_before

gform_entry_detail_content_before

DescriptionUsageParametersExamplesPlacementSource Code

Description
Use this action hook to add extra text/sections before the main content on the Entry detail page.
Usage
1add_action( 'gform_entry_detail_content_before', 'add_main_text_before', 10, 2 );

Parameters

$form Form Object
The form from which the entry value was submitted.

$entry Entry Object
The current entry.

Examples
This example adds a new section with a header and text.
1234add_action( 'gform_entry_detail_content_before', 'add_main_text_before', 10, 2 );function add_main_text_before( $form, $entry ) {    echo '

Main Content Before
some stuff

';}
Placement
This code should be placed in the functions.php file of your active theme.
Source Code
This filter is located in GFEntryDetail::lead_detail_page() in entry_detail.php.

gform_entry_detail_content_after

gform_entry_detail_content_after

DescriptionUsageParametersExamplesPlacementSource Code

Description
Use this action hook to add extra text/sections after the main content on the Entry detail page.
Usage
1add_action( 'gform_entry_detail_content_after', 'add_main_text_after', 10, 2 );

Parameters

$form Form Object
The form from which the entry value was submitted.

$entry Entry Object
The current entry.

Examples
This example adds a new section with a header and text.
1234add_action( 'gform_entry_detail_content_after', 'add_main_text_after', 10, 2 );function add_main_text_after( $form, $entry ) {    echo '

Main Content After
some stuff

';}
Placement
This code should be placed in the functions.php file of your active theme.
Source Code
This filter is located in GFEntryDetail::lead_detail_page() in entry_detail.php.

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.