Action uncanny-learndash-toolkit

uo_login_before_reset_success_message

Fires before the success message is displayed after a successful password reset.

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

Description

Fires just before the password reset success message is displayed on the login form. Use this hook to modify the message, add custom content, or perform actions after a successful password reset before the success notice appears.


Usage

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

Examples

<?php
/**
 * Example function to hook into the 'uo_login_before_reset_success_message' action.
 * This function demonstrates how to log a message or modify the success message
 * before it's displayed to the user after a password reset.
 *
 * @param string $reset_password_sucess The success message string.
 */
function my_custom_reset_success_message( $reset_password_sucess ) {
	// Log that a password reset success message is about to be displayed.
	// In a real-world scenario, you might want to pass more context or user information.
	error_log( 'Password reset success message is about to be displayed. Message: ' . $reset_password_sucess );

	// You could potentially modify the message here if needed, though this hook is 'before'.
	// For example, adding a prefix or suffix.
	// return 'Your password has been reset successfully! ' . $reset_password_sucess;

	// Since this is an action hook and not a filter, we don't need to return anything
	// unless we intend to modify the original content (which is usually done with filters).
	// However, if the hook's intention allows for it and the source code expects it,
	// you might return the potentially modified variable if it's passed by reference or
	// if the function is designed to accept and modify it. Given the example's structure,
	// it seems like the success message ($reset_password_sucess) is intended to be echoed directly
	// after this hook. If this hook were a filter, we'd return the modified string.
}

// Add the action hook.
// The 'uo_login_before_reset_success_message' hook expects the success message string
// to be passed to it. The '1' indicates the priority, and '1' indicates that the
// function accepts one argument.
add_action( 'uo_login_before_reset_success_message', 'my_custom_reset_success_message', 10, 1 );

// --- Example of how you might use it with a filter hook if you wanted to modify ---
// If you intended to modify the message itself, a filter hook would be more appropriate.
// For demonstration, let's assume a hypothetical filter hook 'uo_login_reset_success_message'.

/**
 * Example function to hook into a hypothetical filter for modifying the reset success message.
 *
 * @param string $message The original success message.
 * @return string The modified success message.
 */
function my_modified_reset_success_message( $message ) {
	// Add a custom prefix to the success message.
	$modified_message = '✨ ' . $message . ' ✨';
	return $modified_message;
}

// Add the hypothetical filter hook.
// The 'uo_login_reset_success_message' filter hook expects the success message string
// and should return the (potentially modified) string.
// add_filter( 'uo_login_reset_success_message', 'my_modified_reset_success_message', 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/layout_1-login.php:158
src/templates/frontend-login/layout_1-login.php:162
src/templates/frontend-login/modern_ui-login.php:165
src/templates/frontend-login/modern_ui-login.php:169
src/classes/frontend-login-plus.php:3813
src/classes/frontend-login-plus.php:3817

<div class="ult-form__content">
			
			<?php if ( isset( $reset_password_sucess ) && ! empty( $reset_password_sucess ) ){ ?>

				<?php do_action( 'uo_login_before_reset_success' ); ?>

				<div class="ult-notice ult-notice--success">
					<?php do_action( 'uo_login_before_reset_success_message' ); ?>

					<?php echo $reset_password_sucess; ?>

					<?php do_action( 'uo_login_before_reset_success_message' ); ?>
				</div>

			<?php } ?>


Scroll to Top