Login_Forms
Login form helpers for the Document Library Login Form
Tags
Table of Contents
- $attribute_mapping : array<string|int, mixed>
- Attribute mapping from camelCase to snake_case
- get_access_control_options() : array<string|int, mixed>
- Get access control options
- get_default_block_attributes() : array<string|int, mixed>
- Get default block attributes that mirror global settings
- get_form() : string
- Render login shortcode
- get_login_notices() : false|array<string|int, mixed>
- Get login notices
- get_password_form() : string
- Render the password form
- get_password_form_data() : string|array<string|int, mixed>
- Get password form configuration data
- get_session_identifier() : string
- Get session identifier that works for both authenticated and unauthenticated users
- get_user_form() : string
- Render the user form
- get_user_form_data() : string|array<string|int, mixed>
- Get user form configuration data
- get_user_permission_status() : array<string|int, mixed>
- Get user permission status for the current context
- check_user_permissions() : bool
- Check if current user has permissions for the given protection types
- generate_permission_notice_message() : string
- Generate contextual notice message for logged-in users without permission
- get_current_page_title() : string
- Get the current page title (post or taxonomy archive)
- get_logout_login_url() : string
- Get logout URL with redirect back to current page
- get_template_variables() : array<string|int, mixed>
- Get template variables for the login form
- get_user_ip() : string
- Get user IP address with proxy support
- merge_custom_attributes() : array<string|int, mixed>
- Merge custom attributes with global settings
- normalize_attributes() : array<string|int, mixed>
- Normalize attributes from camelCase to snake_case format
- should_show_form_for_logged_user() : bool
- Determine if a form should be shown for a logged-in user without permission
Properties
$attribute_mapping
Attribute mapping from camelCase to snake_case
private
static array<string|int, mixed>
$attribute_mapping
= ['showPasswordForm' => 'show_password_form', 'showUserForm' => 'show_user_form', 'passwordTitle' => 'password_title', 'passwordMessage' => 'password_message', 'passwordLabel' => 'password_label', 'passwordButton' => 'password_button', 'passwordUsePlaceholder' => 'password_use_placeholder', 'userTitle' => 'user_title', 'userMessage' => 'user_message', 'userButton' => 'user_button', 'columnsWrapClass' => 'columns_wrap_class', 'passwordColumnClass' => 'password_column_class', 'userColumnClass' => 'user_column_class']
Tags
Methods
get_access_control_options()
Get access control options
public
static get_access_control_options() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed> —Access control options.
get_default_block_attributes()
Get default block attributes that mirror global settings
public
static get_default_block_attributes([string|null $key = null ]) : array<string|int, mixed>
Parameters
- $key : string|null = null
-
A specific field key.
Tags
Return values
array<string|int, mixed> —Default block attributes
get_form()
Render login shortcode
public
static get_form([array<string|int, mixed> $atts = [] ][, array<string|int, mixed> $block = null ][, array<string|int, mixed> $protection_types = [] ]) : string
Parameters
- $atts : array<string|int, mixed> = []
-
Shortcode attributes.
- $block : array<string|int, mixed> = null
-
Is this a block (renders button differently)
- $protection_types : array<string|int, mixed> = []
-
Protection types for permission analysis
Tags
Return values
string —get_login_notices()
Get login notices
public
static get_login_notices() : false|array<string|int, mixed>
Tags
Return values
false|array<string|int, mixed> —Login notices.
get_password_form()
Render the password form
public
static get_password_form(array<string|int, mixed> $context[, array<string|int, mixed> $custom_attributes = [] ][, bool $block = false ]) : string
Parameters
- $context : array<string|int, mixed>
- $custom_attributes : array<string|int, mixed> = []
-
Custom form attributes
- $block : bool = false
-
Is this a block (renders button differently)
Tags
Return values
string —get_password_form_data()
Get password form configuration data
public
static get_password_form_data([string|null $key = null ][, array<string|int, mixed> $custom_attributes = [] ]) : string|array<string|int, mixed>
Parameters
- $key : string|null = null
-
A specific field key.
- $custom_attributes : array<string|int, mixed> = []
-
Custom form attributes
Tags
Return values
string|array<string|int, mixed> —Password form configuration data.
get_session_identifier()
Get session identifier that works for both authenticated and unauthenticated users
public
static get_session_identifier() : string
Tags
Return values
string —Session identifier
get_user_form()
Render the user form
public
static get_user_form(array<string|int, mixed> $context[, array<string|int, mixed> $custom_attributes = [] ][, bool $block = false ]) : string
Parameters
- $context : array<string|int, mixed>
- $custom_attributes : array<string|int, mixed> = []
-
Custom form attributes
- $block : bool = false
-
Is this a block (renders button differently)
Tags
Return values
string —get_user_form_data()
Get user form configuration data
public
static get_user_form_data([string|null $key = null ][, array<string|int, mixed> $custom_attributes = [] ]) : string|array<string|int, mixed>
Parameters
- $key : string|null = null
-
A specific field key.
- $custom_attributes : array<string|int, mixed> = []
-
Custom form attributes
Tags
Return values
string|array<string|int, mixed> —User form configuration data.
get_user_permission_status()
Get user permission status for the current context
public
static get_user_permission_status([array<string|int, mixed> $protection_types = [] ][, array<string|int, mixed> $context = [] ]) : array<string|int, mixed>
Parameters
- $protection_types : array<string|int, mixed> = []
-
Protection types that apply to current page
- $context : array<string|int, mixed> = []
-
Page context information
Tags
Return values
array<string|int, mixed> —Permission status information
check_user_permissions()
Check if current user has permissions for the given protection types
private
static check_user_permissions(array<string|int, mixed> $protection_types) : bool
Parameters
- $protection_types : array<string|int, mixed>
-
Protection types to check
Tags
Return values
bool —True if user has permission, false otherwise
generate_permission_notice_message()
Generate contextual notice message for logged-in users without permission
private
static generate_permission_notice_message(array<string|int, mixed> $protection_types, array<string|int, mixed> $context, bool $can_use_password) : string
Parameters
- $protection_types : array<string|int, mixed>
-
Protection types
- $context : array<string|int, mixed>
-
Page context
- $can_use_password : bool
-
Whether password unlock is available
Tags
Return values
string —Formatted notice message
get_current_page_title()
Get the current page title (post or taxonomy archive)
private
static get_current_page_title() : string
Tags
Return values
string —Current page title
get_logout_login_url()
Get logout URL with redirect back to current page
private
static get_logout_login_url() : string
Tags
Return values
string —Logout URL with redirect
get_template_variables()
Get template variables for the login form
private
static get_template_variables([array<string|int, mixed> $custom_attributes = [] ][, bool $block = false ][, array<string|int, mixed> $protection_types = [] ]) : array<string|int, mixed>
Parameters
- $custom_attributes : array<string|int, mixed> = []
-
Custom block/shortcode attributes
- $block : bool = false
-
Is this a block (renders button differently)
- $protection_types : array<string|int, mixed> = []
-
Protection types for permission analysis
Tags
Return values
array<string|int, mixed> —Template variables.
get_user_ip()
Get user IP address with proxy support
private
static get_user_ip() : string
Tags
Return values
string —User IP address
merge_custom_attributes()
Merge custom attributes with global settings
private
static merge_custom_attributes(array<string|int, mixed> $global_settings, array<string|int, mixed> $custom_attributes) : array<string|int, mixed>
Parameters
- $global_settings : array<string|int, mixed>
-
Global access control settings
- $custom_attributes : array<string|int, mixed>
-
Custom block/shortcode attributes
Tags
Return values
array<string|int, mixed> —Merged settings
normalize_attributes()
Normalize attributes from camelCase to snake_case format
private
static normalize_attributes([array<string|int, mixed> $attributes = [] ]) : array<string|int, mixed>
Parameters
- $attributes : array<string|int, mixed> = []
-
Raw attributes (may be camelCase or snake_case)
Tags
Return values
array<string|int, mixed> —Normalized attributes in snake_case format
should_show_form_for_logged_user()
Determine if a form should be shown for a logged-in user without permission
private
static should_show_form_for_logged_user(string $form_type, array<string|int, mixed> $permission_status) : bool
Parameters
- $form_type : string
-
Type of form ('password' or 'user')
- $permission_status : array<string|int, mixed>
-
User permission status
Tags
Return values
bool —True if form should be shown, false otherwise