Action
uncanny-automator-pro
auto_plugin_install-plugin_installed
Fires after a plugin is successfully installed via the auto-install process.
add_action( 'auto_plugin_install-plugin_installed', $callback, 10, 1 );
Description
Fires after a plugin is successfully installed via Uncanny Automator Pro's installer. Developers can use this action to perform custom actions, such as updating plugin-specific settings or triggering other automations based on the installed plugin. The `$package` and `__NAMESPACE__` are passed as arguments.
Usage
add_action( 'auto_plugin_install-plugin_installed', 'your_function_name', 10, 1 );
Parameters
-
$package(mixed) - This parameter contains information about the plugin package that was just installed.
Examples
// Example usage of the 'auto_plugin_install-plugin_installed' action hook.
// This function will be triggered after a plugin has been successfully installed by Uncanny Automator Pro.
add_action( 'auto_plugin_install-plugin_installed', 'my_uncanny_automator_plugin_installed_handler', 10, 2 );
/**
* Handles the event of a plugin being installed by Uncanny Automator Pro.
*
* @param mixed $package The package information of the installed plugin.
* @param mixed $namespace The namespace of the plugin being installed.
*/
function my_uncanny_automator_plugin_installed_handler( $package, $namespace ) {
// In a real-world scenario, you might want to perform some actions based on the installed plugin.
// For instance, you could log the installation, trigger another automation, or update custom data.
// Example: Log the installation details to the WordPress debug log.
if ( WP_DEBUG === true ) {
error_log( "Uncanny Automator Pro: Plugin installed. Package: " . print_r( $package, true ) . ", Namespace: " . esc_html( $namespace ) );
}
// Example: Check if a specific plugin was installed and perform an action.
// Assuming $package contains information like 'slug' or 'name'.
// This is a hypothetical check, the actual structure of $package might vary.
if ( isset( $package['slug'] ) && 'woocommerce' === $package['slug'] ) {
// If WooCommerce was just installed via Uncanny Automator, perhaps we want to send a notification.
// This is just a placeholder for a more complex action.
$message = 'WooCommerce was successfully installed through Uncanny Automator!';
// For a real notification, you might use wp_mail(), add_settings_error(), or a custom notice mechanism.
if ( WP_DEBUG === true ) {
error_log( "WooCommerce installed notification: " . $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
uncanny-automator-pro/src/core/admin/installer/includes/class-upgrader.php:609
public function install( $package, $args = array() ) {
$result = parent::install( $package, $args );
if ( true === $result ) {
do_action( 'auto_plugin_install-plugin_installed', $package, __NAMESPACE__ );
}
return $result;
}