LLMS_REST_Users_Controller::sanitize_username( string $value, WP_REST_Request $request, string $param )
Validate a username is valid and allowed
Parameters Parameters
- $value
-
(string) (Required) User-submitted username.
- $request
-
(WP_REST_Request) (Required) Request object.
- $param
-
(string) (Required) Parameter name.
Return Return
(WP_Error|string) Sanitized username if valid or error object.
Source Source
File: libraries/lifterlms-rest/includes/abstracts/class-llms-rest-users-controller.php
/** * Validate a username is valid and allowed * * @since 1.0.0-beta.1 * * @param string $value User-submitted username. * @param WP_REST_Request $request Request object. * @param string $param Parameter name. * @return WP_Error|string Sanitized username if valid or error object. */ public function sanitize_username( $value, $request, $param ) { $username = (string) $value; if ( ! validate_username( $username ) ) { return llms_rest_bad_request_error( __( 'Username contains invalid characters.', 'lifterlms' ) ); } /** * Filter defined in WP Core. * * @link https://developer.wordpress.org/reference/hooks/illegal_user_logins/
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
Version | Description |
---|---|
1.0.0-beta.1 | Introduced. |