PHP code example of amostajo / wordpress-login-page
1. Go to this page and download the library: Download amostajo/wordpress-login-page library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
amostajo / wordpress-login-page example snippets
'Amostajo\Wordpress\LoginPageAddon\LoginPage',
add_filter( 'addon_loginpage_redirect_to', 'filter_redirect' );
function filter_redirect($redirect)
{
// Modification
$redirect = home_url( '/my-account.php' );
// Array is expected in return
return $redirect;
}
add_filter( 'registration_errors', 'filter_signup_errors' );
function filter_signup_errors($errors, $user_login, $user_email)
{
// Adding custom validations
if ( strlen( Request::input( 'user_pass' ) ) >= 8 ) {
$errors->add(
'password_length',
'Field <strong>Password</strong> should contain at least 8 characters.'
);
}
if ( !Request::input( 'address' ) ) {
$errors->add(
'empty_address',
'Field <strong>Address</strong> can not be empty.'
);
}
// WP_Error
return $errors;
}
add_filter( 'addon_loginpage_signup_message', 'filter_signup_message' );
function filter_signup_message($message)
{
return 'Thanks for registering with us!';
}
add_filter( 'retrieve_password_title', 'filter_reset_email_title' );
function filter_reset_email_title($title)
{
return 'Forgot your password?';
}
add_filter( 'registration_errors', 'filter_resetpassword_errors' );
function filter_resetpassword_errors($errors, $input, $user)
{
// Adding custom validation
if ( strlen( $input[ 'user_pass' ] ) >= 8 ) {
$errors->add(
'password_length',
'Field <strong>Password</strong> should contain at least 8 characters.'
);
}
// WP_Error
return $errors;
}
add_filter( 'addon_loginpage_forgotpassword_message', 'filter_forgotpassword_message' );
function filter_forgotpassword_message($message)
{
return 'Reset instructions sent to your inbox.';
}