Using Gravity Forms ‘gform_entry_detail_content_after’ PHP action

The gform_entry_detail_content_after action hook allows you to add extra text or sections after the main content on the Entry detail page in Gravity Forms.

Usage

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

More information

See Gravity Forms Docs: gform_entry_detail_content_after

Examples

Add a new section with a header and text

This example adds a new section with a header and text after the main content on the Entry detail page.

add_action('gform_entry_detail_content_after', 'add_main_text_after', 10, 2);

function add_main_text_after($form, $entry) {
    echo '<table class="widefat fixed entry-detail-view" cellspacing="0"><thead><tr><th>Main Content After</th></tr></thead><tbody><tr><td>Some extra content</td></tr></tbody></table>';
}

Place this code in the functions.php file of your active theme.

Display entry data in a new section

This example displays the entry data for a specific field in a new section after the main content on the Entry detail page.

add_action('gform_entry_detail_content_after', 'display_entry_data', 10, 2);

function display_entry_data($form, $entry) {
    $field_id = 3; // Set the field ID
    $field_value = rgar($entry, $field_id);
    echo "<p><strong>Field ID {$field_id}:</strong> {$field_value}</p>";
}

Add a custom note to the entry detail page

This example adds a custom note after the main content on the Entry detail page, using the entry ID.

add_action('gform_entry_detail_content_after', 'add_custom_note', 10, 2);

function add_custom_note($form, $entry) {
    $entry_id = $entry['id'];
    echo "<p>Custom note for entry ID {$entry_id}</p>";
}

Display a message based on the entry’s status

This example displays a message after the main content on the Entry detail page, based on the entry’s status.

add_action('gform_entry_detail_content_after', 'display_status_message', 10, 2);

function display_status_message($form, $entry) {
    $entry_status = $entry['status'];
    if ($entry_status == 'spam') {
        echo "<p>This entry has been marked as spam.</p>";
    } elseif ($entry_status == 'trash') {
        echo "<p>This entry is in the trash.</p>";
    } else {
        echo "<p>This entry is active.</p>";
    }
}

Show a custom message for a specific form

This example shows a custom message after the main content on the Entry detail page for a specific form, using the form ID.

add_action('gform_entry_detail_content_after', 'show_custom_message_for_form', 10, 2);

function show_custom_message_for_form($form, $entry) {
    $target_form_id = 5; // Set the target form ID
    if ($form['id'] == $target_form_id) {
        echo "<p>Custom message for form ID