uo-front-login-lost-pwd-template
Filters the template file loaded for the user lost password form before it is displayed.
add_filter( 'uo-front-login-lost-pwd-template', $callback, 10, 2 );
Description
Filters the template file used for displaying the "lost password" form on the frontend. Developers can hook into this filter to load a custom template for the lost password functionality.
Usage
add_filter( 'uo-front-login-lost-pwd-template', 'your_function_name', 10, 2 );
Parameters
-
$template_to_load(mixed) - This parameter contains the name of the template file to be loaded for the lost password form.
-
$template_to_load(mixed) - This parameter allows you to filter and modify the path to the template file used for the lost password form.
Return Value
The filtered value.
Examples
/**
* Filters the template file used for the lost password form on the frontend login page.
*
* This example adds a custom template file for the lost password form if a specific
* setting is enabled in the WordPress admin.
*
* @param string $template_to_load The default template file to load.
* @return string The modified template file path.
*/
add_filter( 'uo-front-login-lost-pwd-template', function( $template_to_load, $original_template_part ) {
// Check if a custom setting is enabled to use a different lost password template.
// Replace 'my_plugin_use_custom_lost_password_template' with your actual option name.
if ( get_option( 'my_plugin_use_custom_lost_password_template', false ) ) {
// If the custom template option is enabled, return a different template file.
// Replace 'my-custom-templates/frontend-login/custom-lost-pwd.php' with your actual custom template path.
return 'my-custom-templates/frontend-login/custom-lost-pwd.php';
}
// Otherwise, return the original template file path.
return $template_to_load;
}, 10, 2 );
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/login-page-ui-default.php:47
src/templates/login-page-ui-default.php:72
src/templates/frontend-login/login-modal.php:23
</div>
<?php
} elseif ( $lost_password ) {
//If User is requesting a lost password, show form!
include Config::get_template( apply_filters( 'uo-front-login-lost-pwd-template', 'frontend-login/' . $template_to_load . '-lost-pwd.php', $template_to_load ) );
} elseif ( $reset_password_sent ) {
$forgot_password_response = (object) array(
'error' => true,
'message' => '',
);
//When Lost Password Form is submitted, show status!