Action
uncanny-automator
automator_before_settings
Fires before the Automator settings page is loaded, allowing modifications to settings before they are displayed to the user.
add_action( 'automator_before_settings', $callback, 10, 1 );
Description
Fires before the Automator plugin's settings form is rendered. Developers can use this hook to add custom fields, modify the form's structure, or perform actions just before the settings page displays. It's primarily for internal use and advanced customization of the settings interface.
Usage
add_action( 'automator_before_settings', 'your_function_name', 10, 1 );
Examples
add_action( 'automator_before_settings', 'my_custom_automator_settings_logic', 10, 0 );
/**
* Example function to perform custom actions before the Automator settings are displayed.
* This could be used to conditionally modify settings fields, add custom HTML,
* or perform other logic based on the current context or user capabilities.
*/
function my_custom_automator_settings_logic() {
// Example: Check if the current user has a specific capability before showing an extra message.
if ( current_user_can( 'manage_options' ) ) {
echo '<div class="notice notice-info"><p>Welcome back, Administrator! Here are your Automator settings.</p></div>';
}
// Example: Conditionally disable a certain setting group based on a plugin option.
$option_name = 'my_plugin_disable_automator_feature';
if ( get_option( $option_name ) === 'yes' ) {
// This is a simplified example; in a real scenario, you'd likely
// interact with the $tab object or similar to modify how settings are rendered.
// For this hook, we can only output HTML *before* the settings.
echo '<div class="notice notice-warning"><p>Some advanced Automator features are temporarily disabled.</p></div>';
}
}
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:27
src/core/includes/automator-settings.php:193
<?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 ) ) {
settings_fields( $tab->settings_field );
}
if ( isset( $tab->wp_nonce_field ) ) {
wp_nonce_field( $tab->wp_nonce_field, $tab->wp_nonce_field );
}