Action
uncanny-automator-pro
automator_pro_after_anon_user_action_completed
Fires after an Automator Pro anonymous user action is successfully completed, providing details about the user, recipe, log, and attributes.
add_action( 'automator_pro_after_anon_user_action_completed', $callback, 10, 4 );
Description
Fires after an anonymous user completes an action within an Uncanny Automator Pro recipe. Developers can use this hook to perform custom actions, log data, or modify attributes related to the completed anonymous user action. It's triggered after the core recipe processing for the anonymous user is finalized.
Usage
add_action( 'automator_pro_after_anon_user_action_completed', 'your_function_name', 10, 4 );
Parameters
-
$user_id(mixed) - This parameter contains the ID of the user who completed the action.
-
$recipe_id(mixed) - The user ID associated with the anonymous action.
-
$trigger_log_id(mixed) - This parameter contains the ID of the recipe that has just had an anonymous user action completed.
-
$attributes(mixed) - This parameter contains the ID of the log entry associated with the trigger that initiated the anonymous user action.
Examples
<?php
/**
* Example of how to hook into the automator_pro_after_anon_user_action_completed action.
* This function will be executed after an anonymous user action is completed in Uncanny Automator Pro.
* It will log the details of the completed action to the WordPress debug log.
*
* @param mixed $user_id The ID of the user (can be null for anonymous users).
* @param mixed $recipe_id The ID of the recipe that was completed.
* @param mixed $trigger_log_id The ID of the trigger log entry.
* @param mixed $attributes An array of attributes associated with the trigger.
*/
function my_automator_pro_log_anon_user_action_completion( $user_id, $recipe_id, $trigger_log_id, $attributes ) {
// Log details about the completed action to the WordPress debug log.
if ( WP_DEBUG === true ) {
error_log(
sprintf(
'Uncanny Automator Pro: Anonymous user action completed. User ID: %s, Recipe ID: %s, Trigger Log ID: %s, Attributes: %s',
$user_id ? $user_id : 'Anonymous',
$recipe_id,
$trigger_log_id,
print_r( $attributes, true )
)
);
}
// You could also perform other actions here, like sending a notification,
// updating a custom database table, or integrating with a third-party service.
// For example, you might want to check if a specific attribute exists and act on it:
if ( isset( $attributes['some_custom_data_key'] ) && ! empty( $attributes['some_custom_data_key'] ) ) {
$custom_data = $attributes['some_custom_data_key'];
// Do something with $custom_data
error_log( 'Found custom data: ' . $custom_data );
}
}
// Add the action hook.
// The '4' in the third parameter specifies that our callback function accepts 4 arguments.
add_action( 'automator_pro_after_anon_user_action_completed', 'my_automator_pro_log_anon_user_action_completion', 10, 4 );
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/includes/automator-pro-recipe-process-complete.php:355
$trigger_log_id,
$attributes,
),
'4.3',
'automator_pro_after_anon_user_action_completed'
);
do_action( 'automator_pro_after_anon_user_action_completed', $user_id, $recipe_id, $trigger_log_id, $attributes );
return $attributes;
}
/**
* Update recipe and trigger logs with the resolved user ID.
*