Show form creation date on forms list [RESOLVED]

I need to know the creation dates of my forms. I found this thread from last year about adding a column for this to the forms list, but I need additional detail:

In that thread, @chrishajer says the date is stored in the database and that you can use gform_form_list_columns to add a column to display it. I found this page (https://docs.gravityforms.com/form-object/) with form objects, but how do I call the date_created object and display it in a column on the forms list?

The examples I’ve found for using gform_form_list_columns have only shown how to remove columns or change the name of a column.

So far I’ve tried adding variations of the following to functions.php, but it didn’t work.

add_filter( 'gform_form_list_columns', 'add_column', 10, 1 );
function add_columns( $columns ){
    $columns = rgar( $form, 'date_created' );
    return $columns;
}

Your custom hook isn’t working because you’re attempting to add the date created from a $form object which doesn’t exist. The gform_form_list_columns filter is only for defining which columns should appear in the Form List, not what their values should be.

You need to implement the gform_form_list_columns filter like this:

/**
 * Add Date Created to Form List.
 *
 * @param array $columns Form List columns.
 */
add_filter( 'gform_form_list_columns', function( $columns ) {

	$columns['date_created'] = 'Date Created';
	return $columns;

} );

You also need to implement the gform_form_list_column_{COLUMN} action to display the form creation date:

/**
 * Display Date Created in Form List.
 *
 * @param array $form Form object.
 */
add_action( 'gform_form_list_column_date_created', function( $form ) {

	echo esc_html( rgobj( $form, 'date_created' ) );

} );
2 Likes

That did it, thank you!