Login
in package
Login and login tracking functionality.
- Modify login form contents.
- Redirect login to user-only page if not an administrator.
- Set user login history values for current and previous logins.
Tags
Table of Contents
Constants
- LAST_LOGIN_KEY = 'pnet_login_last'
- Metadata key for last login.
- LOGIN_NOTICE_CONTAINER = 'notice.php'
- Login notice partial filename.
- PREV_LOGIN_KEY = 'pnet_login_previous'
- Metadata key for previous login.
- REQUEST_LINK_CONTAINER = 'lost-password.php'
- Request password reset partial filename.
Properties
- $instances : array<string|int, object>
- The array of instances of this class and sub-classes.
- $login_notice_container : string
- Login notice container path.
- $messages : Messages
- The instance of the Messages class.
- $progress_container : string
- The progress indicator container markup.
- $request_link_container : string
- Request password reset container path.
Methods
- add_password_reset() : void
- Render a password reset link on login form.
- add_progress_indicator() : void
- Add the progress indicator.
- disable_email_check() : bool
- Disable site admin email verification at login.
- disable_language_dropdown() : bool
- Remove language selector from login page.
- get_error_text() : string
- Override standard error message to not disclose valid username or email.
- get_instance() : object
- Creates and/or returns the instance of this class.
- get_login_message() : string
- Return a login required notification if login has a redirect.
- get_logo_url() : string
- Return site url for login page.
- get_logo_url_title() : string
- Return site name for login page.
- remove_shake() : void
- Remove shake on login error.
- set_last_login() : void
- Updates the latest login by a user.
- __construct() : void
- Initialise the class.
Constants
LAST_LOGIN_KEY
Metadata key for last login.
protected
string
LAST_LOGIN_KEY
= 'pnet_login_last'
Tags
LOGIN_NOTICE_CONTAINER
Login notice partial filename.
protected
string
LOGIN_NOTICE_CONTAINER
= 'notice.php'
Tags
PREV_LOGIN_KEY
Metadata key for previous login.
protected
string
PREV_LOGIN_KEY
= 'pnet_login_previous'
Tags
REQUEST_LINK_CONTAINER
Request password reset partial filename.
protected
string
REQUEST_LINK_CONTAINER
= 'lost-password.php'
Tags
Properties
$instances
The array of instances of this class and sub-classes.
protected
static array<string|int, object>
$instances
= array()
Tags
$login_notice_container
Login notice container path.
protected
string
$login_notice_container
= ''
Tags
$messages
The instance of the Messages class.
protected
Messages
$messages
Tags
$progress_container
The progress indicator container markup.
protected
string
$progress_container
= ''
Tags
$request_link_container
Request password reset container path.
protected
string
$request_link_container
= ''
Tags
Methods
add_password_reset()
Render a password reset link on login form.
public
add_password_reset() : void
Tags
add_progress_indicator()
Add the progress indicator.
public
add_progress_indicator() : void
Tags
disable_email_check()
Disable site admin email verification at login.
public
disable_email_check() : bool
Tags
Return values
booldisable_language_dropdown()
Remove language selector from login page.
public
disable_language_dropdown() : bool
Tags
Return values
boolget_error_text()
Override standard error message to not disclose valid username or email.
public
get_error_text(string $errors) : string
Parameters
- $errors : string
-
The error message(s).
Tags
Return values
string —The error message to show.
get_instance()
Creates and/or returns the instance of this class.
public
static get_instance() : object
Tags
Return values
object —The instance of this class.
get_login_message()
Return a login required notification if login has a redirect.
public
get_login_message(string $message) : string
Parameters
- $message : string
-
The login message.
Tags
Return values
string —The (maybe) modified login message.
get_logo_url()
Return site url for login page.
public
get_logo_url() : string
Tags
Return values
string —The site homepage URL.
get_logo_url_title()
Return site name for login page.
public
get_logo_url_title() : string
Tags
Return values
string —The site name.
remove_shake()
Remove shake on login error.
public
remove_shake() : void
Tags
set_last_login()
Updates the latest login by a user.
public
set_last_login(string $user_name, WP_User $user) : void
- Store current value as previous login.
Parameters
- $user_name : string
-
User name.
- $user : WP_User
-
Logged-in user object.
Tags
__construct()
Initialise the class.
protected
__construct() : void