Using Gravity Forms ‘gform_entry_detail_meta_boxes’ PHP filter

The gform_entry_detail_meta_boxes filter in Gravity Forms allows you to add custom meta boxes to the entry detail page.

Usage

The basic usage of the filter is as follows:

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

In the function your_function_name, insert your custom code. The function should return the first variable, $meta_boxes.

Parameters

  • $meta_boxes (array): Contains the properties for the meta boxes.
  • $entry (Entry Object): The entry that is currently being viewed/edited.
  • $form (Form Object): The form object that is used to process the current entry.

More information

See Gravity Forms Docs: gform_entry_detail_meta_boxes

Examples

Enable the Payment Details

This code enables 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;
}

User Registration Add-On

This code adds 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.

function register_ur_meta_box( $meta_boxes, $entry, $form ) {
    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 );

function add_ur_details_meta_box( $args ) {
    // your custom code here
}