Using Gravity Forms ‘gform_entry_detail’ PHP action

The gform_entry_detail Gravity Forms action hook allows you to add extra text to the Entry detail page.

Usage

add_action('gform_entry_detail', 'add_to_details', 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

Examples

Display additional text on form ID 31

This example displays additional text on all entries for form ID 31 when viewing the Entry details.

add_action('gform_entry_detail', 'add_to_details', 10, 2);

function add_to_details($form, $entry) {
    if ($form['id'] == 31) {
        echo '<div>This hook is used to add additional information to the details page for an entry.</div>';
    }
}

Add extra details based on entry data

This example shows how to add extra text to the Entry detail page based on specific entry data.

add_action('gform_entry_detail', 'add_extra_entry_details', 10, 2);

function add_extra_entry_details($form, $entry) {
    if ($entry['5'] == 'yes') {
        echo '<div><strong>Customer opted-in for newsletter subscription.</strong></div>';
    }
}

Display a message based on a custom field value

This example displays a message on the Entry detail page based on a custom field value.

add_action('gform_entry_detail', 'display_message_based_on_custom_field', 10, 2);

function display_message_based_on_custom_field($form, $entry) {
    if ($entry['customField'] == 'VIP') {
        echo '<div><strong>This is a VIP customer.</strong></div>';
    }
}

Add a custom HTML section

This example adds a custom HTML section to the Entry detail page.

add_action('gform_entry_detail', 'add_custom_html_section', 10, 2);

function add_custom_html_section($form, $entry) {
    echo '<div class="custom-section">';
    echo '<h3>Custom Section</h3>';
    echo '<p>Here you can add any custom content or information you need.</p>';
    echo '</div>';
}

Display additional information for entries submitted on a specific date

This example displays additional information for entries submitted on a specific date.

add_action('gform_entry_detail', 'display_info_for_specific_date', 10, 2);

function display_info_for_specific_date($form, $entry) {
    $entry_date = strtotime($entry['date_created']);
    $specific_date = strtotime('2023-05-03');

    if ($entry_date == $specific_date) {
        echo '<div><strong>Entry submitted on a special date!</strong></div>';
    }
}