uo-front-login-register-template
Filters the login/registration template to load, allowing customization of the user interface.
add_filter( 'uo-front-login-register-template', $callback, 10, 1 );
Description
Filters the template file used for displaying the front-end login, registration, or lost password forms. Developers can use this to load custom template files for these interfaces, overriding the default ones. This filter is applied when the login, registration, or lost password user interfaces are being rendered.
Usage
add_filter( 'uo-front-login-register-template', 'your_function_name', 10, 1 );
Return Value
The filtered value.
Examples
/**
* Example of modifying the login/registration template path.
*
* This filter allows you to change the default template file used for the
* registration form within the Uo Toolkit's login/registration UI.
* For instance, you might have a custom registration template you want to use.
*
* @param string $template_to_load The default template path segment.
* @param string $current_template_path The full path to the current template being considered.
* @return string The modified template path segment.
*/
add_filter( 'uo-front-login-register-template', function( $template_to_load, $current_template_path ) {
// Let's say we have a custom registration template in a subdirectory
// named 'custom-themes' and we want to use a file named 'my-custom-register.php'.
// We need to construct the full path to our custom template.
// First, check if the default template is the one we want to override.
// This assumes the default template segment is 'default' or similar.
// You might need to adjust this condition based on how $template_to_load is used elsewhere.
if ( 'frontend-login/default-register.php' === $current_template_path ) {
// If it is, let's prepend a custom theme directory to the $template_to_load segment
// and then append our custom register file name.
return 'custom-themes/my-custom-register.php';
}
// Otherwise, return the original template 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:76
$forgot_password_response->message = apply_filters( 'uo_toolkit_reset_password_errors', $forgot_password_response->message );
include Config::get_template( apply_filters( 'uo-front-login-lost-pwd-template', 'frontend-login/' . $template_to_load . '-lost-pwd.php', $template_to_load ) );
} elseif ( $register ) {
//If registration is open and user is on register page!
if ( $register_show ) {
include Config::get_template( apply_filters( 'uo-front-login-register-template', 'frontend-login/' . $template_to_load . '-register.php', $template_to_load ) );
}
} elseif ( $reset_password ) {
//When user clicks reset password link in email!
if ( isset( $_GET['key'] ) && isset( $_GET['login'] ) ) {
$rp_key = $_GET['key'];
$rp_login = $_GET['login'];
$rp_cookie = 'wp-resetpass-' . COOKIEHASH;