Action uncanny-automator

automator_activation_views_after

Fires after automator plugin activation views have been processed and displayed.

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

Description

Fires after the database views are created or updated during plugin activation. Developers can use this hook to perform actions that depend on the database views being fully set up, such as migrating existing data or registering custom view-related components. It's crucial that any actions here assume the views are already generated.


Usage

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

Examples

<?php

/**
 * Add custom logging or notification after database views are activated/created.
 *
 * This example demonstrates how to hook into the 'automator_activation_views_after'
 * action to log a message indicating that database views have been successfully
 * created or updated. In a real-world scenario, you might use this to send
 * an email notification to an administrator or trigger other post-activation tasks.
 */
add_action( 'automator_activation_views_after', 'my_automator_views_activation_handler', 10 );

function my_automator_views_activation_handler() {
	// Log a message to the WordPress debug log or a custom log file.
	// Replace this with your desired logic, e.g., sending an email.
	error_log( 'Automator database views have been activated/updated successfully.' );

	// Optionally, you could check if views were *actually* created in this run
	// by inspecting the version difference before and after the hook fires.
	// For simplicity, this example just logs a general success message.
}

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/class-automator-db.php:392

public function automator_generate_views() {

		do_action( 'automator_database_views_before' );

		if ( AUTOMATOR_DATABASE_VIEWS_VERSION !== automator_get_option( 'uap_database_views_version', 0 ) ) {
			self::create_views();
		}

		do_action( 'automator_activation_views_after' );
	}


Scroll to Top