Action uncanny-automator

automator_before_settings_form

Fires before the main Automator settings form is displayed, allowing for modifications before rendering.

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

Description

Fires before the Automator settings form is rendered. This hook allows developers to add custom content, perform actions, or modify the settings form's structure before it's displayed. It's ideal for integrations that need to inject their own settings or UI elements into the main Automator settings page.


Usage

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

Examples

<?php
/**
 * Example function to hook into the 'automator_before_settings_form' action.
 * This function will output a custom message before the main settings form is displayed.
 *
 * @since 1.0.0
 */
function my_custom_automator_settings_message() {
	// Check if this is the correct context (e.g., the main settings tab)
	// In a real scenario, you might want to check the current admin page or a specific query parameter.
	// For this example, we'll assume it's always appropriate to show the message when this hook fires.

	// Output a friendly informational message to the user.
	echo '<div class="notice notice-info"><p><strong>Important Notice:</strong> Please review your settings carefully before saving. Changes may affect your automations.</p></div>';

	// You could also conditionally display other HTML elements, or even fetch data from the database.
	// For example:
	// $last_saved = get_option( 'my_automator_settings_last_saved' );
	// if ( $last_saved ) {
	//     echo '<p>Last saved on: ' . esc_html( date_i18n( get_option( 'date_format' ) . ' ' . get_option( 'time_format' ), $last_saved ) ) . '</p>';
	// }
}

// Add the action hook.
// The second parameter (10) is the priority, and the third parameter (0) indicates that the callback function accepts no arguments.
add_action( 'automator_before_settings_form', 'my_custom_automator_settings_message', 10, 0 );

?>

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/includes/automator-settings.php:22
src/core/includes/automator-settings.php:188

if ( ! empty( $tab ) && 'settings' !== $active ) {
	?>
	<div class="wrap"> <!-- WP container -->
		<div class="uo-settings">
			<div class="uo-settings-content">
				<?php
				do_action_deprecated( 'uap_before_automator_settings_form', array(), '3.0', 'automator_before_settings_form' );
				do_action( 'automator_before_settings_form' );
				?>
				<form class="uo-settings-content-form" method="POST" action="options.php">
					<?php
					do_action_deprecated( 'uap_before_automator_settings', array(), '3.0', 'automator_before_settings' );
					do_action( 'automator_before_settings' );
					if ( $tab ) {
						if ( isset( $tab->settings_field ) ) {


Scroll to Top