pfeifferNet

Form_User_Account extends Form_User_Account
in package

User account edit profile form functionality.

Tags
since
5.7.0
uses
Form_User_Account

Table of Contents

Constants

ABOUT_IMAGE_KEY  = 'psite_about_image'
Define user about about image key name.
EXTRA_VALIDATION_HOOK  = 'pnet_validation'
The extra_validation hook base name.
FORM_ACTION  = 'account_edit'
The admin_post hook action name.
FORM_CONTAINER  = 'form-user-account.php'
Form container partial.
FORM_NAME  = 'account_maintenance'
The name attribute of the form.
MEDIA_FIELD_NAME  = 'psite_about_image'
The media selector field name attribute.
NEXT_PAGE  = ''
The page to redirect to when closing form response banner.
NONCE_ACTION  = 'update_account'
The form nonce action.
NONCE_ACTION_EMAIL  = 'change_email'
The email change nonce action.
NONCE_ACTION_PASSWORD  = 'change_password'
The password change nonce action.
NONCE_EMAIL  = 'token-em'
The nonce name for email cancellation.
NONCE_NAME  = 'token'
The nonce name.
NONCE_PASSWORD  = 'token-pwd'
The nonce name for password cancellation.
NOTIFICATION_CONTAINER  = 'notification.php'
Message container partial.
RESPONSE_PAGE  = ''
The page to redirect to for form submission response.

Properties

$form_container  : string
The fully qualified path to the form container partial.
$form_header  : string
The text before the form.
$http_handler  : HTTP_Handler
The instance of the HTTP_Handler class.
$instances  : array<string|int, object>
The array of instances of this class and sub-classes.
$media_data  : array<string|int, mixed>
The media selector image data.
$media_selector  : Media_Selector
The instance of the Media_Selector class.
$messages  : Messages
The instance of the Messages class.
$next_url  : string
The fully qualified path to the next page after closing the success banner.
$notification_container  : string
The fully qualified path to the message container partial.
$notifications  : array<string|int, string>
The marked up notifications to display at top of form.
$pending_email_change  : bool
The flag to indicate q pending email change.
$pending_password_change  : bool
The flag to indicate a pending password change.
$progress_container  : string
The progress indicator container markup.
$recaptcha_site_key  : string
Google reCAPTCHA V3 site key.
$response_url  : string
The fully qualified path to the submission response target.
$success_message_code  : string
The success message code.
$user  : User
The instance of the User class.
$user_account  : User_Account
The instance of the User_Account class.
$user_data  : array<string|int, mixed>
The user profile basic data.
$user_home_url  : string
The fully qualified path to the user home page.
$user_id  : int
The current user id.
$validation_hook  : string
The name of the extra validation hook.

Methods

get_form_action()  : string
Return the form action.
get_instance()  : object
Creates and/or returns the instance of this class.
get_validation_hook()  : string
Return the extra validation hook name.
handle_submission()  : void
Handle the form submission.
render()  : void
Render the form.
__construct()  : void
Initialize the class.
add_notifications()  : void
Add conditional messages to form.
cancel_email_change()  : bool
Cancel a pending email change.
cancel_password_change()  : bool
Cancel a pending password change.
do_intercepts()  : void
Take special actions before initialising the form.
do_submission()  : WP_Error
Execute the submission request.
enqueue_assets()  : void
Enqueue the resources.
get_inline_script()  : string
Get the inline JavaScript.
render_success_notification()  : void
Render the success notification.
set_form_header()  : void
Set the form header text.
set_form_values()  : void
Initialise the values used in the form.
validate_email()  : WP_Error
Validate the email address.
validate_submission()  : WP_Error
Validate the submitted form contents.

Constants

ABOUT_IMAGE_KEY

Define user about about image key name.

protected string ABOUT_IMAGE_KEY = 'psite_about_image'
Tags
since
5.3.0

EXTRA_VALIDATION_HOOK

The extra_validation hook base name.

protected string EXTRA_VALIDATION_HOOK = 'pnet_validation'
Tags
since
5.8.0

FORM_ACTION

The admin_post hook action name.

protected string FORM_ACTION = 'account_edit'
Tags
since
5.7.0

FORM_CONTAINER

Form container partial.

protected string FORM_CONTAINER = 'form-user-account.php'
Tags
since
5.7.0

FORM_NAME

The name attribute of the form.

protected string FORM_NAME = 'account_maintenance'
Tags
since
6.0.0

MEDIA_FIELD_NAME

The media selector field name attribute.

protected string MEDIA_FIELD_NAME = 'psite_about_image'
Tags
since
5.8.0

NEXT_PAGE

The page to redirect to when closing form response banner.

protected string NEXT_PAGE = ''
  • Override this constant in the child class.
  • Page name must start with a slash to be appended to home_url().
Tags
since
6.4.0

NONCE_ACTION

The form nonce action.

protected string NONCE_ACTION = 'update_account'
Tags
since
5.7.0

NONCE_ACTION_EMAIL

The email change nonce action.

protected string NONCE_ACTION_EMAIL = 'change_email'
Tags
since
5.7.0

NONCE_ACTION_PASSWORD

The password change nonce action.

protected string NONCE_ACTION_PASSWORD = 'change_password'
Tags
since
5.7.0

NONCE_EMAIL

The nonce name for email cancellation.

protected string NONCE_EMAIL = 'token-em'

.

Tags
since
5.7.0

NONCE_NAME

The nonce name.

protected string NONCE_NAME = 'token'
Tags
since
5.5.0

NONCE_PASSWORD

The nonce name for password cancellation.

protected string NONCE_PASSWORD = 'token-pwd'

.

Tags
since
5.7.0

NOTIFICATION_CONTAINER

Message container partial.

protected string NOTIFICATION_CONTAINER = 'notification.php'
Tags
since
6.0.0

RESPONSE_PAGE

The page to redirect to for form submission response.

protected string RESPONSE_PAGE = ''
  • Override this constant in the child class.
Tags
since
5.5.0

Properties

$form_container

The fully qualified path to the form container partial.

protected string $form_container = ''
Tags
since
5.5.0

$form_header

The text before the form.

protected string $form_header = ''
  • This is the text to display between the page content and the form.
  • Describes the required field markup.
  • Set in set_form_header() to allow translation.
Tags
since
6.0.0

$http_handler

The instance of the HTTP_Handler class.

protected HTTP_Handler $http_handler
Tags
since
5.8.0

$instances

The array of instances of this class and sub-classes.

protected static array<string|int, object> $instances = array()
Tags
since
5.11.0

$media_data

The media selector image data.

protected array<string|int, mixed> $media_data = array()

The array of meta data about the media.

Tags
since
5.8.0
see
Media::IMAGE_ATTRIBUTE_DEFAULTS

$messages

The instance of the Messages class.

protected Messages $messages
Tags
since
5.8.0

$next_url

The fully qualified path to the next page after closing the success banner.

protected string $next_url = ''
  • Blank means no redirection.
Tags
since
6.4.0

$notification_container

The fully qualified path to the message container partial.

protected string $notification_container = ''
Tags
since
6.0.0

$notifications

The marked up notifications to display at top of form.

protected array<string|int, string> $notifications = array()
Tags
since
5.5.0

$pending_email_change

The flag to indicate q pending email change.

protected bool $pending_email_change = false
Tags
since
5.7.0

$pending_password_change

The flag to indicate a pending password change.

protected bool $pending_password_change = false
Tags
since
5.7.0

$progress_container

The progress indicator container markup.

protected string $progress_container = ''
Tags
since
6.0.0

$recaptcha_site_key

Google reCAPTCHA V3 site key.

protected string $recaptcha_site_key = ''
Tags
since
5.6.0

$response_url

The fully qualified path to the submission response target.

protected string $response_url = ''
Tags
since
5.5.0

$success_message_code

The success message code.

protected string $success_message_code = ''
  • This is the key to the success message from the message handler.
  • It is of the form "success_{FORM_ACTION}"
Tags
since
5.8.0

$user_data

The user profile basic data.

protected array<string|int, mixed> $user_data = array()
  • This is of the form that Wp userdata provides.
  • It includes standard user metadata.
Tags
since
5.7.0
see
User::get_data()

$user_home_url

The fully qualified path to the user home page.

protected string $user_home_url = ''
Tags
since
5.7.0

$validation_hook

The name of the extra validation hook.

protected string $validation_hook = ''
  • This adds the FORM_ACTION to the EXTRA_VALIDATION_HOOK constant.
Tags
since
5.8.0

Methods

get_form_action()

Return the form action.

public get_form_action() : string
  • This is the {action} part of the admin_post hook.
Tags
since
5.5.0
Return values
string

The form action.

get_instance()

Creates and/or returns the instance of this class.

public static get_instance() : object
Tags
since
5.11.0
Return values
object

The instance of this class.

get_validation_hook()

Return the extra validation hook name.

public get_validation_hook() : string
Tags
since
5.8.0
Return values
string

The hook name.

add_notifications()

Add conditional messages to form.

protected add_notifications([array<string|int, string> $get_vars = array() ]) : void
Parameters
$get_vars : array<string|int, string> = array()

The sanitised $_GET arguments.

Tags
since
5.7.0
uses
Messages::get_message()

cancel_email_change()

Cancel a pending email change.

protected cancel_email_change([array<string|int, string> $get_vars = array() ]) : bool
Parameters
$get_vars : array<string|int, string> = array()

The sanitised $_GET vars, including a nonce.

Tags
since
5.7.0
Return values
bool

Success or failure.

cancel_password_change()

Cancel a pending password change.

protected cancel_password_change([array<string|int, string> $get_vars = array() ]) : bool
Parameters
$get_vars : array<string|int, string> = array()

{ The sanitised $_GET vars, including a nonce. @type string $key The hashed new email address. }

Tags
since
5.7.0
Return values
bool

Success or failure.

do_intercepts()

Take special actions before initialising the form.

protected do_intercepts([array<string|int, string> $get_vars = array() ]) : void
Parameters
$get_vars : array<string|int, string> = array()

{ The sanitised $_GET arguments, including a nonce. @type string $action The action to take. }

Tags
since
5.7.0
uses
Messages::get_banner()

do_submission()

Execute the submission request.

protected do_submission(WP_Error $errors, array<string|int, string> $post_vars, array<string|int, string> $server_vars) : WP_Error
Parameters
$errors : WP_Error

The WP_Error object to use if errors.

$post_vars : array<string|int, string>

The sanitised $_POST arguments.

$server_vars : array<string|int, string>

The sanitised $_SERVER arguments.

Tags
since
5.7.0
uses
User::update()
Return values
WP_Error

The maybe modified WP_Error object.

get_inline_script()

Get the inline JavaScript.

protected get_inline_script() : string
Tags
since
6.4.0
Return values
string

The inline script.

set_form_header()

Set the form header text.

protected set_form_header() : void
  • (Maybe) extend this in child classes to set specific instructions for that form.
Tags
since
6.0.0

set_form_values()

Initialise the values used in the form.

protected set_form_values(array<string|int, string> $get_vars, array<string|int, string> $server_vars) : void
Parameters
$get_vars : array<string|int, string>

The sanitised $_GET arguments.

$server_vars : array<string|int, string>

The sanitised $_SERVER arguments.

Tags
since
5.8.0
see
Media_Selector::render()

validate_email()

Validate the email address.

protected validate_email(array<string|int, string> $post_vars, WP_Error $errors) : WP_Error
Parameters
$post_vars : array<string|int, string>

The sanitised $_POST arguments.

$errors : WP_Error

The WP_Error object to use if errors.

Tags
since
5.7.0
Return values
WP_Error

The maybe modified WP_Error object.

validate_submission()

Validate the submitted form contents.

protected validate_submission(WP_Error $errors, array<string|int, string> $post_vars, array<string|int, string> $server_vars) : WP_Error
Parameters
$errors : WP_Error

The WP_Error object to use if errors.

$post_vars : array<string|int, string>

The sanitised $_POST arguments.

$server_vars : array<string|int, string>

The sanitised $_SERVER arguments.

Tags
since
5.7.0
Return values
WP_Error

The maybe modified WP_Error object.


        
On this page

Search results