Action
uncanny-automator-pro
uap_auto_login_link_success
Fires after a successful auto-login link generation and processing for user access.
add_action( 'uap_auto_login_link_success', $callback, 10, 1 );
Description
Fires after a user successfully logs in via an Uncanny Automator Pro auto-login link. Developers can use this hook to perform custom actions or redirects immediately following a successful auto-login, before the user is redirected to their final destination.
Usage
add_action( 'uap_auto_login_link_success', 'your_function_name', 10, 1 );
Examples
add_action( 'uap_auto_login_link_success', 'my_custom_auto_login_success_handler', 10, 0 );
/**
* Custom handler for the uap_auto_login_link_success action hook.
* This function logs a custom message to the WordPress debug log
* whenever an auto-login link is successfully used by Uncanny Automator Pro.
*/
function my_custom_auto_login_success_handler() {
// Ensure WP_DEBUG is true to see this log message.
if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
error_log( 'Uncanny Automator Pro: Auto-login link was successfully used. Performing custom actions...' );
// Example: You could conditionally add a user meta field here
// if you wanted to track how many times a user logs in via an auto-login link.
// For instance, if you had access to the user object.
// Since this hook doesn't provide the user object directly,
// you'd need a different approach if user-specific actions are required.
// This example just demonstrates logging.
// Example: You could also trigger another custom action or filter
// to further process this event if needed.
// do_action( 'my_custom_post_auto_login_actions', get_current_user_id() );
}
}
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/integrations/advanced/tokens/autologin-link-token.php:186
private function log_in_and_redirect( $user ) {
wp_clear_auth_cookie();
wp_set_current_user( $user->ID );
wp_set_auth_cookie( $user->ID );
do_action( 'uap_auto_login_link_success' );
$url = admin_url( 'profile.php' );
if ( automator_filter_has_var( 'redirect_to' ) ) {
$url = automator_filter_input( 'redirect_to' );
}
wp_safe_redirect( apply_filters( 'uap_auto_login_link_success_redirect', $url, $user ) );
exit();
}