The gform_form_summary filter allows you to modify the forms displayed in the Dashboard Forms widget.
Usage
add_filter('gform_form_summary', 'your_custom_function', 10, 1); function your_custom_function($forms) { // your custom code here return $forms; }
Parameters
- $forms (array): Array containing all forms, including the unread entries count, total entries count, and date of the last entry submission.
More information
See Gravity Forms Docs: gform_form_summary
Examples
Order Forms By Total Entries
This example sorts the forms in the Dashboard Forms widget by the total number of entries in descending order.
add_filter('gform_form_summary', 'order_form_summary_by_total_entries', 10, 1); function order_form_summary_by_total_entries($forms) { usort($forms, function($a, $b) { return $b['total_entries'] - $a['total_entries']; }); return $forms; }
Order Forms By Unread Entries
This example sorts the forms in the Dashboard Forms widget by the number of unread entries in descending order.
add_filter('gform_form_summary', 'order_form_summary_by_unread_entries', 10, 1); function order_form_summary_by_unread_entries($forms) { usort($forms, function($a, $b) { return $b['unread_entries'] - $a['unread_entries']; }); return $forms; }
Hide Forms With Zero Unread Entries
This example hides forms with no unread entries from the Dashboard Forms widget.
add_filter('gform_form_summary', 'hide_forms_with_zero_unread_entries', 10, 1); function hide_forms_with_zero_unread_entries($forms) { $filtered_forms = array_filter($forms, function($form) { return $form['unread_entries'] > 0; }); return $filtered_forms; }
Show Only Forms With More Than 100 Total Entries
This example shows only forms with more than 100 total entries in the Dashboard Forms widget.
add_filter('gform_form_summary', 'show_forms_with_more_than_100_total_entries', 10, 1); function show_forms_with_more_than_100_total_entries($forms) { $filtered_forms = array_filter($forms, function($form) { return $form['total_entries'] > 100; }); return $filtered_forms; }
Change Date Format of Last Entry Submission
This example changes the date format of the last entry submission displayed in the Dashboard Forms widget.
add_filter('gform_form_summary', 'change_last_entry_submission_date_format', 10, 1); function change_last_entry_submission_date_format($forms) { foreach ($forms as &$form) { $form['last_entry_date'] = date('F j, Y', strtotime($form['last_entry_date'])); } return $forms; }