uo_forgot_email_actions
Fires after the forgotten password email has been sent to the user.
add_action( 'uo_forgot_email_actions', $callback, 10, 1 );
Description
Fires after the password recovery email input field is displayed on the frontend. Use this action to add custom elements, buttons, or additional form fields related to password recovery directly after the email input.
Usage
add_action( 'uo_forgot_email_actions', 'your_function_name', 10, 1 );
Examples
<?php
/**
* Example: Add a custom link or button within the forgot password email form actions.
*
* This function demonstrates how to hook into the 'uo_forgot_email_actions' action
* to add a custom element, such as a "Back to Login" link, next to the existing
* form elements within the password recovery form.
*/
add_action( 'uo_forgot_email_actions', 'my_custom_forgot_email_actions', 10 );
function my_custom_forgot_email_actions() {
// Assuming $innerText is available in the context where this hook is fired.
// In a real scenario, you might need to pass it or access it differently
// if it's not globally available or passed as an argument.
// For demonstration, let's assume we can access it.
global $innerText; // This is often not good practice, but can be necessary if variables aren't passed.
// Check if the $innerText array and the specific key exist to avoid errors.
if ( isset( $innerText['Back-to-Login-Link-Text'] ) ) {
echo '<a href="' . esc_url( home_url( '/login/' ) ) . '" class="ult-form-field__action-link">' . esc_html( $innerText['Back-to-Login-Link-Text'] ) . '</a>';
} else {
// Fallback or default text if the key is not found.
echo '<a href="' . esc_url( home_url( '/login/' ) ) . '" class="ult-form-field__action-link">' . esc_html__( 'Back to Login', 'your-text-domain' ) . '</a>';
}
}
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/modern_ui-lost-pwd.php:93
src/templates/frontend-login/layout_1-lost-pwd.php:86
<div class="ult-form-field__header">
<div class="ult-form-field__label-container">
<label for="ult-forgot-email" class="ult-form-field__label">
<?php echo $innerText['Password-Recovery-Label']; ?>
</label>
</div>
<div class="ult-form-field__actions">
<?php do_action( 'uo_forgot_email_actions' ); ?>
</div>
</div>
<div class="ult-form__field">
<input required type="text" name="user_login" id="ult-forgot-email" class="ult-form__input" placeholder="">
</div>
</div>