Search code examples
wordpressgravity-forms-plugingravityforms

Gravity Forms: Print entry info in metabox ( Not just show it by default layout)


At this time i am working on Gravity Forms Metaboxes. I need some entry info to be printed in metabox. I have this code

function statcounter_tracking_box( $meta_boxes, $entry, $form ) {
        if ( ! isset( $meta_boxes['test'] ) ) {
            $meta_boxes['test'] = array(
                'title'         => esc_html__( 'Custom Test', 'gravityforms' ),
                'callback'      => array( 'GFEntryDetail', 'meta_box_entry_info' ),
                'context'       => 'normal',
                'callback_args' => array( $entry, $form ), 
            );     
        } 

    return $meta_boxes;
}

The result in meta box is: See Image As you see I have just Default layout showing in metabox. I need to just print (print_r) Entry info (entry Id, Submitted, User IP) in metabox to have variables of all info and then use it for other purposes. I tried to have a custom function in callback, changed meta_box_entry_info with my function name to just echo Hello world but it's not working because callback requires default functions built in gravity. Please help


Solution

  • Try replacing the whole callback value with your custom function.

    function statcounter_tracking_box( $meta_boxes, $entry, $form ) {
            if ( ! isset( $meta_boxes['test'] ) ) {
                $meta_boxes['test'] = array(
                    'title'         => esc_html__( 'Custom Test', 'gravityforms' ),
                    'callback'      => 'my_custom_callback_function',
                    'context'       => 'normal',
                    'callback_args' => array( $entry, $form ), 
                );     
            } 
    
        return $meta_boxes;
    }