Filter uncanny-automator

automator_system_report_get

Filters the data returned for the system report, allowing modification before it's displayed.

add_filter( 'automator_system_report_get', $callback, 10, 1 );

Description

Fires when the system report data is being generated. Developers can use this filter to modify or add custom information to the system report array before it's returned. This is useful for including plugin-specific environment details or debugging information.


Usage

add_filter( 'automator_system_report_get', 'your_function_name', 10, 1 );

Parameters

$this (mixed)
This parameter is an array containing various system information, including automator statistics, environment details, database information, and a list of active plugins.

Return Value

The filtered value.


Examples

// Add a custom section to the Automator system report detailing the last time Automator was updated.
add_filter( 'automator_system_report_get', 'my_automator_add_last_update_info', 20, 1 );

/**
 * Adds custom information about the last update time to the Automator system report.
 *
 * @param array $system_status The existing system status array.
 * @return array The modified system status array with the new information.
 */
function my_automator_add_last_update_info( $system_status ) {

	// Fetch the last update timestamp from WordPress's transient API.
	// This is a hypothetical transient key, you'd use a real one if available or manage your own.
	$last_update_timestamp = get_transient( 'automator_last_update_timestamp' );

	// If no timestamp is found, set a default message.
	if ( ! $last_update_timestamp ) {
		$last_update_info = __( 'Automator has not been updated recently or the update timestamp is not recorded.', 'your-text-domain' );
	} else {
		// Format the timestamp into a human-readable date.
		$last_update_info = sprintf(
			__( 'Last updated on: %s', 'your-text-domain' ),
			date_i18n( get_option( 'date_format' ) . ' ' . get_option( 'time_format' ), $last_update_timestamp )
		);
	}

	// Add our custom information to the system status array.
	$system_status['my_custom_automator_update_info'] = $last_update_info;

	return $system_status;
}

Placement

This code should be placed in the functions.php file of your active theme, a custom plugin, or using a code snippets plugin.


Source Code

src/core/lib/utilities/class-automator-system-report.php:37

public function get() {

		$system_status = apply_filters(
			'automator_system_report_get',
			array(
				'automator_stats'    => $this->get_automator_stats(),
				'environment'        => $this->get_environment_info(),
				'database'           => $this->get_database_info(),
				'active_plugins'     => $this->get_active_plugins(),
				'inactive_plugins'   => $this->get_inactive_plugins(),
				'dropins_mu_plugins' => $this->get_dropins_mu_plugins(),
				'theme'              => $this->get_theme_info(),
			)
		);

		return $system_status;
	}

Internal Usage

Found in uncanny-automator-pro/src/boot.php:78:

add_filter( 'automator_system_report_get', array( $this, 'display_last_updated' ), 10, 1 );
Scroll to Top