uo_login_before_validation_message
Fires before login validation messages are displayed, allowing for modifications.
add_action( 'uo_login_before_validation_message', $callback, 10, 1 );
Description
Fires just before the login error message is displayed, allowing developers to inject custom content or modify the error output. Useful for adding extra context or troubleshooting information directly within the login message area.
Usage
add_action( 'uo_login_before_validation_message', 'your_function_name', 10, 1 );
Examples
// Add a custom message to the login error display if a specific user role is attempting to log in.
add_action( 'uo_login_before_validation_message', function() {
// Check if the current user is logged in and has a specific role.
// This is a hypothetical check; you would replace 'specific_role' with an actual role slug.
if ( is_user_logged_in() && current_user_can( 'specific_role' ) ) {
echo '<p class="custom-login-message">You are attempting to log in with a restricted role. Please use the appropriate portal.</p>';
}
}, 10, 0 ); // Priority 10, 0 arguments accepted.
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:124
src/templates/frontend-login/modern_ui-login.php:124
// Do uo_login_before_validation
do_action( 'uo_login_before_validation' );
?>
<div class="ult-form__validation <?php echo implode( ' ', $css_classes ); ?>">
<div class="ult-notice ult-notice--error">
<?php do_action( 'uo_login_before_validation_message' ); ?>
<span class="ult-notice-text"><?php echo $error; ?></span>
<?php do_action( 'uo_login_after_validation_message' ); ?>
</div>
</div>