Filter uncanny-automator

automator_action_log_status

Filters the HTML output for an action's status in the Automator log.

add_filter( 'automator_action_log_status', $callback, 10, 2 );

Description

Filters the HTML for an action's log status. This hook allows developers to modify or replace the default status display based on the action object. It's useful for custom styling, adding extra status details, or completely altering how an action's completion status is presented in the logs.


Usage

add_filter( 'automator_action_log_status', 'your_function_name', 10, 2 );

Parameters

$action_status_html (mixed)
This parameter contains the HTML output for the action's status.
$action (mixed)
This parameter contains the HTML output for the action's status, which can be modified by the filter.

Return Value

The filtered value.


Examples

/**
 * Modify the action log status HTML to display a custom status for completed actions
 * that have a specific metadata value.
 *
 * @param string $action_status_html The original HTML for the action status.
 * @param object $action             The action object, which may contain custom properties.
 * @return string The modified HTML for the action status.
 */
add_filter( 'automator_action_log_status', function( $action_status_html, $action ) {
	// Check if the action has a custom metadata indicating a specific completion type.
	// This is a hypothetical example; the actual metadata key would depend on your plugin's logic.
	if ( isset( $action->custom_completion_type ) && 'manual_override' === $action->custom_completion_type ) {
		return '<span class="automator-status automator-status-manual">Manual Override Completed</span>';
	}

	// If not a custom type, return the original HTML.
	return $action_status_html;
}, 10, 2 );

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/admin/admin-logs/wp-list-table/class-logs-list-table.php:901

$action_date_html = $this->get_completion_date_html( $action->action_date, 'action' );

			if ( false !== $action_date_html ) {
				$action_date_completed = $action_date_html;
			}

			$action_status = apply_filters( 'automator_action_log_status', $action_status_html, $action );
			$error_message = apply_filters( 'automator_action_log_error', $action->error_message, $action );

			/**
			 * Replaced get_edit_post_link() to get_edit_link
			 *
			 * <https://developer.wordpress.org/reference/functions/get_edit_post_link/>
			 *


Internal Usage

Found in uncanny-automator-pro/src/core/classes/actions-conditions.php:92:

add_filter( 'automator_action_log_status', array( $this, 'action_log_status_display' ), 10, 2 );

Found in uncanny-automator-pro/src/core/classes/async-actions.php:40:

add_filter( 'automator_action_log_status', array( $this, 'action_log_status' ), 10, 2 );
Scroll to Top