Action uncanny-learndash-toolkit

uo_reset_password_actions

Fires after a user's password has been successfully reset, allowing for custom actions.

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

Description

Fires after the password reset form is displayed. Developers can use this hook to add custom content or functionality before or after the reset form, such as extra fields or confirmation messages.


Usage

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

Examples

<?php
/**
 * Example function hooked to the 'uo_reset_password_actions' action.
 *
 * This function demonstrates adding a custom field or message after the password
 * input during the password reset process, before the confirm password field.
 * In this example, we'll add a simple informational message.
 *
 * @param WP_User|null $user The user object if authenticated, otherwise null.
 */
function my_custom_reset_password_actions( $user = null ) {
    // Check if we have a user object (though for this action, it might not always be passed)
    if ( $user ) {
        // You could potentially use user meta here if needed, e.g., to show
        // a message based on user role or other profile data.
        // For this example, we'll show a general message.
        ?>
        <p class="uo-reset-password-message">
            <?php esc_html_e( 'Please choose a strong password that you can remember.', 'your-text-domain' ); ?>
        </p>
        <?php
    } else {
        // If no user object is available, still show a generic message.
        ?>
        <p class="uo-reset-password-message">
            <?php esc_html_e( 'Your password will be reset.', 'your-text-domain' ); ?>
        </p>
        <?php
    }
}

// Add the function to the 'uo_reset_password_actions' hook.
// The '10' is the priority, and '1' indicates that the function accepts one argument ($user).
add_action( 'uo_reset_password_actions', 'my_custom_reset_password_actions', 10, 1 );
?>

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/templates/frontend-login/default-reset-pwd.php:39
src/templates/frontend-login/modern_ui-reset-pwd.php:75
src/templates/frontend-login/layout_1-reset-pwd.php:68

<input type="password" data-reveal="1"
                                       data-pw="<?php echo esc_attr( wp_generate_password( 16 ) ); ?>" name="pass1"
                                       id="pass1" class="input" size="20" value="" autocomplete="off"
                                       aria-describedby="pass-strength-result" required/>
                            </span>
        </div>
        <div class="wp-pwd">
			<?php do_action( 'uo_reset_password_actions' ); ?>
        </div>
    </div>
	<?php do_action( 'uo_reset_before_confirm_password' ); ?>
    <p class="user-pass2-wrap">
        <label for="pass2"><?php echo $innerText['Confirm-Password']; ?></label><br/>
        <input type="password" name="pass2" id="pass2" class="input" size="20" value="" autocomplete="off" required/>
    </p>


Scroll to Top