The gform_system_report
filter in Gravity Forms permits modifications to the sections displayed on the System Status page. You can add, remove, or alter the text of the displayed sections.
Usage
To utilize this filter, you can use add_filter()
function as shown below:
add_filter( 'gform_system_report', 'your_function_name' );
In the place of 'your_function_name'
, you should insert your custom function that implements your desired changes.
Parameters
$system_report
(array): This is the array of default sections that are displayed on the System Status page.
More information
See Gravity Forms Docs: gform_system_report
This filter was first implemented in version 2.2. The filter should be added to the functions.php
file of your active theme. The source code for this filter can be found in system_report.php
.
Examples
Adding a New Section
Let’s add a new section called ‘Custom Section’ to the System Status report.
function add_custom_section( $system_report ) { // your custom code here $system_report['custom_section'] = 'This is a custom section.'; return $system_report; } add_filter( 'gform_system_report', 'add_custom_section' );
In the above example, a new section named ‘Custom Section’ with the text ‘This is a custom section.’ gets added to the System Status page.
Removing a Section
You can remove a default section from the System Status page.
function remove_section( $system_report ) { // your custom code here unset($system_report['default_section']); return $system_report; } add_filter( 'gform_system_report', 'remove_section' );
The above code removes the ‘default_section’ from the System Status page.
Modifying a Section’s Text
You can also change the text of an existing section.
function modify_section_text( $system_report ) { // your custom code here $system_report['existing_section'] = 'Modified text for the existing section'; return $system_report; } add_filter( 'gform_system_report', 'modify_section_text' );
This code changes the text of the ‘existing_section’ on the System Status page.
Adding Multiple Sections
Multiple sections can be added at once.
function add_multiple_sections( $system_report ) { // your custom code here $system_report['section_one'] = 'This is section one.'; $system_report['section_two'] = 'This is section two.'; return $system_report; } add_filter( 'gform_system_report', 'add_multiple_sections' );
This code will add two new sections, ‘section_one’ and ‘section_two’, to the System Status page.
Clearing All Sections
If you want to remove all existing sections and start afresh, use the following code:
function clear_all_sections( $system_report ) { // your custom code here $system_report = array(); return $system_report; } add_filter( 'gform_system_report', 'clear_all_sections' );
This code will remove all existing sections from the System Status page.