Action uncanny-automator

automator_dashboard_header_after

Fires after the Automator dashboard header is rendered, allowing for custom additions.

add_action( 'automator_dashboard_header_after', $callback, 10, 1 );

Description

Fires after the main Automator dashboard header content and before notices or primary dashboard elements. Developers can use this hook to inject custom content, actions, or UI elements directly after the header, such as additional buttons or contextual information, without affecting the core header structure.


Usage

add_action( 'automator_dashboard_header_after', 'your_function_name', 10, 1 );

Examples

/**
 * Example function to display a custom message after the Automator dashboard header.
 * This function will be hooked into the 'automator_dashboard_header_after' action.
 *
 * @param AutomatorAdminDashboard $dashboard The dashboard object, if passed by the hook.
 */
function my_custom_automator_header_message( $dashboard = null ) {

	// Check if the dashboard object is available.
	if ( $dashboard && property_exists( $dashboard, 'site_connected' ) && $dashboard->site_connected ) {
		echo '<div class="notice notice-info"><p>Your Automator site is connected successfully!</p></div>';
	} else {
		// Optionally, display a different message if the site is not connected.
		// echo '<div class="notice notice-warning"><p>Please ensure your Automator site is connected.</p></div>';
	}
}

// Hook the custom function to the 'automator_dashboard_header_after' action.
// We assume the hook might pass the dashboard object, so we set accepted_args to 1.
add_action( 'automator_dashboard_header_after', 'my_custom_automator_header_message', 10, 1 );

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/views/admin-dashboard.php:119

</uo-button>
				
			</uo-button-dropdown>

		<?php } ?>
	</div>

	<?php do_action( 'automator_dashboard_header_after' ); ?>

	<?php

	// If a user is NOT connected, add the notice to connect the site
	if ( ! $dashboard->has_site_connected || ( $dashboard->has_site_connected && $dashboard->is_pro_installed && ! $dashboard->is_pro ) ) {

		?>

Internal Usage

Found in src/core/admin/notifications/notifications.php:72:

add_action( 'automator_dashboard_header_after', array( $this, 'show_notifications' ) );
Scroll to Top