Wordpress Login Page ADD-ON
, (*1)
Add-on package for Wordpress Development Templates., (*2)
Login Page add-on provides fully customizable ajax login, sign up, and password reset pages for wordpress. Everything out-of-the-box!, (*3)
Installation
This package requires Composer., (*4)
Add it in your composer.json
file located on your template's root folder:, (*5)
"amostajo/wordpress-login-page": "1.0.*"
Then run, (*6)
composer install
or, (*7)
composer update
to download package and dependencies., (*8)
Add the following string line in your addons
array option located at your template's config file., (*9)
'Amostajo\Wordpress\LoginPageAddon\LoginPage',
This should be added to:
* config\plugin.php
on Wordpress Plugin Template
* config\theme.php
on Wordpress Theme Template, (*10)
Usage
Once installed and configured, this add-on will change your login, signup and reset password pages without you having to do anything., (*11)
Customization
All views (templates) located at the src/views
folder can be customized in your theme., (*12)
Copy and paste them in your theme's views folder ( with same folder structure), like:, (*13)
[addon-folder]
/src
/views
/addons
/loginpage
/emails
resetpassword.php
login.php
lostpassword.php
resetpassword.php
signup.php
In your theme:, (*14)
[theme-folder]
/views
/addons
/loginpage
/emails
resetpassword.php
login.php
lostpassword.php
resetpassword.php
signup.php
You can modify the HTML and add as many CSS classes as you please to fit your theme. Though there are a couple of things to consider:, (*15)
- Maintain
@submit.prevent
, v-model
, v-show
, and v-for
attributes; otherwise you will lose all processing functionality.
- Maintain
<?php ?>
tags, since they will echo important data in these views.
Hooks
Custom hooks to use (apart from those standard from Wordpress, like user_register
and wp_login
to name a few)., (*16)
FILTER: addon_loginpage_redirect_to
Filters redirect to url., (*17)
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;
}
FILTER: addon_loginpage_signup_userdata
Filters the userdata obtained from sign up form request.
Useful if you need to add more fields to your signup form., (*18)
add_filter( 'addon_loginpage_signup_userdata', 'filter_signup_userdata' );
function filter_signup_userdata($userdata)
{
// Add additional fields
$userdata[ 'user_nicename' ] = Request::input( 'user_nicename' );
$userdata[ 'address' ] = Request::input( 'address' );
// Array is expected in return
return $userdata;
}
FILTER: registration_errors
Filters sign up (registrations) errors.
Useful if you need to remove or add validations., (*19)
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;
}
FILTER: addon_loginpage_signup_message
Filters message shown to user once registration is completed., (*20)
add_filter( 'addon_loginpage_signup_message', 'filter_signup_message' );
function filter_signup_message($message)
{
return 'Thanks for registering with us!';
}
FILTER: retrieve_password_title
Filters email subject / title sent with reset password instructions., (*21)
add_filter( 'retrieve_password_title', 'filter_reset_email_title' );
function filter_reset_email_title($title)
{
return 'Forgot your password?';
}
FILTER: retrieve_password_message
Filters email message sent with reset password instructions.
NOTE: You should better modify the view that comes with the add-on instead of using this filter., (*22)
add_filter( 'retrieve_password_message', 'filter_reset_email_message' );
function filter_reset_email_message($message)
{
return 'Reset password message';
}
FILTER: reset_password_errors
Filters reset password errors.
Useful if you need to remove or add validations., (*23)
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;
}
FILTER: addon_loginpage_forgotpassword_message
Filters message shown to user once reset instructions have been send., (*24)
add_filter( 'addon_loginpage_forgotpassword_message', 'filter_forgotpassword_message' );
function filter_forgotpassword_message($message)
{
return 'Reset instructions sent to your inbox.';
}
FILTER: addon_loginpage_resetpassword_message
Filters message shown to user once password has been reset., (*25)
add_filter( 'addon_loginpage_resetpassword_message', 'filter_resetpassword_message' );
function filter_resetpassword_message($message)
{
return 'Password changed!';
}
Coding Guidelines
The coding is a mix between PSR-2 and Wordpress PHP guidelines., (*26)
License
Page Login ADD-ON is free software distributed under the terms of the MIT license., (*27)