Action uncanny-automator

automator_app_settings_{$id}_after_{$status}_panel_content

Fires after specific app settings panel content is displayed, allowing for custom additions based on the app ID and status.

add_action( 'automator_app_settings_{$id}_after_{$status}_panel_content', $callback, 10, 1 );

Description

Fires after the primary content of an integration's settings panel is displayed, allowing customization based on the integration ID and connection status. Developers can use this hook to add additional fields, information, or dynamic content to the settings page after the core connection status section. It’s crucial to ensure any added content is compatible with the integration and the overall settings UI.


Usage

add_action( 'automator_app_settings_{$id}_after_{$status}_panel_content', 'your_function_name', 10, 1 );

Parameters

$this (mixed)
This parameter is the integration object itself, which contains methods and properties related to the integration's settings and status.

Examples

add_action( 'automator_app_settings_my_integration_after_connected_panel_content', function( $settings_instance ) {
    // This example assumes you want to display a custom message or additional fields
    // after the main content of the 'connected' panel for an integration with ID 'my_integration'.

    // Check if the current user has specific capabilities to see this content.
    if ( current_user_can( 'manage_options' ) ) {
        echo '<div class="automator-custom-message">';
        echo '<h3>Important Notes for Connected Users:</h3>';
        echo '<p>Ensure your API keys are up-to-date to maintain seamless integration.</p>';
        echo '<p>You can find detailed documentation <a href="#" target="_blank">here</a>.</p>';
        echo '</div>';
    }

    // You can also access properties or methods of the $settings_instance if needed.
    // For example, if $settings_instance had a method to get some specific status:
    // if ( $settings_instance->get_specific_service_status() === 'active' ) {
    //     echo '<p>Your service status is currently active.</p>';
    // }

}, 10, 1 ); // Priority 10, accepts 1 argument ($settings_instance)

add_action( 'automator_app_settings_my_integration_after_disconnected_panel_content', function( $settings_instance ) {
    // This example adds a clear call to action for users whose integration is not connected.

    echo '<div class="automator-reconnect-prompt">';
    echo '<h3>Connect Your Account</h3>';
    echo '<p>To use the full features of this integration, please connect your account.</p>';
    echo '<a href="' . esc_url( admin_url( 'admin.php?page=automator-settings&tab=my_integration&action=connect' ) ) . '" class="button button-primary">';
    echo 'Connect Now';
    echo '</a>';
    echo '</div>';

    // You might want to add links to troubleshooting guides here.
    echo '<p><a href="#" target="_blank">Having trouble connecting? Check our troubleshooting guide.</a></p>';

}, 10, 1 ); // Priority 10, accepts 1 argument ($settings_instance)

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/settings/trait-premium-integration-templating.php:169

public function output_panel_content() {
		// Dynamic hook status key.
		$status = $this->get_hook_status_key();
		$id     = $this->get_id();

		// Hook before main content based on integration and connection status.
		do_action( "automator_app_settings_{$id}_before_{$status}_panel_content", $this );

		// Output main content based on connection status
		if ( $this->is_connected ) {
			$this->output_main_connected_content();
		} else {
			$this->output_main_disconnected_content();
		}

		// Hook after main content based on integration and connection status.
		do_action( "automator_app_settings_{$id}_after_{$status}_panel_content", $this );
	}


Scroll to Top