LLMS_REST_Users_Controller::get_item_schema()
Get the item schema
Return Return
(array)
Source Source
File: libraries/lifterlms-rest/includes/abstracts/class-llms-rest-users-controller.php
return array_keys( $wp_roles->roles ); } /** * Get the item schema base. * * @since 1.0.0-beta.27 * * @return array */ protected function get_item_schema_base() { $schema = array( '$schema' => 'http://json-schema.org/draft-04/schema#', 'title' => $this->resource_name, 'type' => 'object', 'properties' => array( 'id' => array( 'description' => __( 'Unique identifier for the user.', 'lifterlms' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'username' => array( 'description' => __( 'Login name for the user.', 'lifterlms' ), 'type' => 'string', 'context' => array( 'edit' ), 'arg_options' => array( 'sanitize_callback' => array( $this, 'sanitize_username' ), ), ), 'name' => array( 'description' => __( 'Display name for the user.', 'lifterlms' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'arg_options' => array( 'sanitize_callback' => 'sanitize_text_field', ), ), 'first_name' => array( 'description' => __( 'First name for the user.', 'lifterlms' ), 'type' => 'string', 'context' => array( 'edit' ), 'arg_options' => array( 'sanitize_callback' => 'sanitize_text_field', ), ), 'last_name' => array( 'description' => __( 'Last name for the user.', 'lifterlms' ), 'type' => 'string', 'context' => array( 'edit' ), 'arg_options' => array( 'sanitize_callback' => 'sanitize_text_field', ), ), 'email' => array( 'description' => __( 'The email address for the user.', 'lifterlms' ), 'type' => 'string', 'format' => 'email', 'context' => array( 'edit' ), 'required' => true, ), 'url' => array( 'description' => __( 'URL of the user.', 'lifterlms' ), 'type' => 'string', 'format' => 'uri', 'context' => array( 'view', 'edit' ), ), 'description' => array( 'description' => __( 'Description of the user.', 'lifterlms' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'nickname' => array( 'description' => __( 'The nickname for the user.', 'lifterlms' ), 'type' => 'string', 'context' => array( 'edit' ), 'arg_options' => array( 'sanitize_callback' => 'sanitize_text_field', ), ), 'registered_date' => array( 'description' => __( 'Registration date for the user.', 'lifterlms' ), 'type' => 'string', 'format' => 'date-time', 'context' => array( 'edit' ), 'readonly' => true, ), 'roles' => array( 'description' => __( 'Roles assigned to the user.', 'lifterlms' ), 'type' => 'array', 'items' => array( 'type' => 'string', 'enum' => $this->get_enum_roles(), ), 'context' => array( 'edit' ), 'default' => array( 'student' ), ), 'password' => array( 'description' => __( 'Password for the user (never included).', 'lifterlms' ), 'type' => 'string', 'context' => array(), // Password is never displayed. 'arg_options' => array( 'sanitize_callback' => array( $this, 'sanitize_password' ), ), ), 'billing_address_1' => array( 'description' => __( 'User address line 1.', 'lifterlms' ), 'type' => 'string', 'context' => array( 'edit' ), 'arg_options' => array( 'sanitize_callback' => 'sanitize_text_field', ), ), 'billing_address_2' => array( 'description' => __( 'User address line 2.', 'lifterlms' ), 'type' => 'string', 'context' => array( 'edit' ), 'arg_options' => array( 'sanitize_callback' => 'sanitize_text_field', ), ), 'billing_city' => array( 'description' => __( 'User address city name.', 'lifterlms' ), 'type' => 'string', 'context' => array( 'edit' ), 'arg_options' => array( 'sanitize_callback' => 'sanitize_text_field', ), ), 'billing_state' => array( 'description' => __( 'User address ISO code for the state, province, or district.', 'lifterlms' ), 'type' => 'string', 'context' => array( 'edit' ), 'arg_options' => array( 'sanitize_callback' => 'sanitize_text_field', ), ), 'billing_postcode' => array( 'description' => __( 'User address postal code.', 'lifterlms' ), 'type' => 'string', 'context' => array( 'edit' ), 'arg_options' => array( 'sanitize_callback' => 'sanitize_text_field', ), ), 'billing_country' => array( 'description' => __( 'User address ISO code for the country.', 'lifterlms' ), 'type' => 'string', 'context' => array( 'edit' ), 'arg_options' => array( 'sanitize_callback' => 'sanitize_text_field', ), ), ), ); if ( get_option( 'show_avatars' ) ) { $avatar_properties = array(); foreach ( rest_get_avatar_sizes() as $size ) { $avatar_properties[ $size ] = array( // Translators: %d = avatar image size in pixels. 'description' => sprintf( __( 'Avatar URL with image size of %d pixels.', 'lifterlms' ), $size ), 'type' => 'string', 'format' => 'uri', 'context' => array( 'view', 'edit' ), ); } $schema['properties']['avatar_urls'] = array( 'description' => __( 'Avatar URLs for the user.', 'lifterlms' ),
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
Version | Description |
---|---|
1.0.0-beta.1 | Introduced. |