uo_login_before_register
Fires before the user registration form is displayed on the login page.
add_action( 'uo_login_before_register', $callback, 10, 1 );
Description
Fires before the registration link is displayed on the login form. Developers can use this hook to add custom content or modify the registration process before the user is presented with the registration option. It's useful for implementing pre-registration checks or adding promotional material.
Usage
add_action( 'uo_login_before_register', 'your_function_name', 10, 1 );
Examples
/**
* Example function to hook into 'uo_login_before_register' action.
* This function could be used to display additional information or forms
* before the registration link is shown to the user.
*
* For instance, you might want to show a disclaimer or a promotional message.
*
* @param object $login The login object, which might contain configuration and URL data.
*/
add_action( 'uo_login_before_register', function( $login ) {
// Check if registration is enabled before showing any extra content.
// The hook itself is placed within a conditional block checking $login->config->can_register,
// but it's good practice to double-check if your hook logic depends on it.
if ( isset( $login->config->can_register ) && $login->config->can_register ) {
// Display a custom message or a link to a specific page.
echo '<div class="custom-registration-promo">';
echo '<p><strong>Special offer:</strong> Register now and get 10% off your first purchase!</p>';
echo '<p><a href="' . esc_url( home_url( '/special-offers/' ) ) . '">Learn more about our offers.</a></p>';
echo '</div>';
// You could also conditionally display other form elements here if needed.
// For example, if there's a specific referral code field that should appear
// only on certain registration contexts before the main registration link.
}
}, 10, 1 ); // Priority 10, accepts 1 argument.
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:218
src/templates/frontend-login/modern_ui-login.php:225
<a id="ult-form-footer-forgot-password" href="<?php echo $login->urls->forgot_password; ?>">
<?php echo $login->strings->forgot_password; ?>
</a>
</div>
<?php if ( $login->config->can_register ){ ?>
<?php do_action( 'uo_login_before_register' ); ?>
<div class="ult-form-footer__signup">
<a href="<?php echo $login->urls->register; ?>"><?php echo $login->strings->register; ?></a>
</div>
<?php do_action( 'uo_login_after_register' ); ?>