Filter
uncanny-automator
automator_token_reset_password_link_html
Filters the HTML output for the password reset link.
add_filter( 'automator_token_reset_password_link_html', $callback, 10, 2 );
Description
Filters the HTML for the password reset link generated by Uncanny Automator. Developers can modify the entire link or its URL for custom reset processes or to inject additional attributes. This hook fires during token generation.
Usage
add_filter( 'automator_token_reset_password_link_html', 'your_function_name', 10, 2 );
Parameters
-
$reset_pw_url(mixed) - This parameter contains the URL for resetting the user's password.
-
$user_id(mixed) - This parameter contains the URL that the user will be redirected to in order to reset their password.
Return Value
The filtered value.
Examples
// Modify the reset password link HTML to include a custom class for styling.
add_filter(
'automator_token_reset_password_link_html',
function ( $reset_pw_link_html, $user_id ) {
// Ensure we have a valid user ID.
if ( ! is_numeric( $user_id ) || $user_id <= 0 ) {
return $reset_pw_link_html; // Return original HTML if user ID is invalid.
}
// Add a custom class to the anchor tag for specific styling.
$modified_html = str_replace( '<a href', '<a class="custom-password-reset-link" href', $reset_pw_link_html );
return $modified_html;
},
10,
2 // Accepts $reset_pw_link_html and $user_id as arguments.
);
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/deprecated/legacy-token-parser.php:820
src/core/lib/utilities/class-automator-input-parser.php:767
public function generate_reset_token( $user_id = 0 ) {
$text = esc_attr_x( 'Click here to reset your password.', 'Reset password token text', 'uncanny-automator' );
$reset_pw_url = $this->reset_password_url_token( $user_id );
return apply_filters(
'automator_token_reset_password_link_html',
'<a href="' . esc_url( $reset_pw_url ) . '" title="' . esc_attr( $text ) . '">'
. esc_html( $text )
. '</a>',
$user_id
);
}