BP_REST_Signup_Endpoint::get_endpoint_args_for_item_schema( string $method = WP_REST_Server::CREATABLE )
Edit the type of the some properties for the CREATABLE & EDITABLE methods.
Description
Parameters
- $method
-
(Optional) HTTP method of the request.
Default value: WP_REST_Server::CREATABLE
Return
(array) Endpoint arguments.
Source
File: bp-members/classes/class-bp-rest-signup-endpoint.php
public function get_endpoint_args_for_item_schema( $method = WP_REST_Server::CREATABLE ) { $args = WP_REST_Controller::get_endpoint_args_for_item_schema( $method ); $key = 'get_item'; if ( WP_REST_Server::CREATABLE === $method ) { $key = 'create_item'; if ( ! function_exists( 'bp_xprofile_nickname_field_id' ) ) { $args['signup_username'] = array( 'context' => array( 'edit' ), 'description' => __( 'New user Username .', 'buddyboss' ), 'type' => 'string', 'required' => true, 'sanitize_callback' => 'sanitize_user', 'validate_callback' => 'rest_validate_request_arg', ); } $args['signup_email'] = array( 'context' => array( 'edit' ), 'description' => __( 'New user email address.', 'buddyboss' ), 'type' => 'string', 'required' => true, 'sanitize_callback' => 'sanitize_email', 'validate_callback' => 'rest_validate_request_arg', ); if ( function_exists( 'bp_register_confirm_email' ) && true === bp_register_confirm_email() ) { $args['signup_email_confirm'] = array( 'context' => array( 'edit' ), 'description' => __( 'New user confirm email address.', 'buddyboss' ), 'type' => 'string', 'required' => true, 'sanitize_callback' => 'sanitize_email', 'validate_callback' => 'rest_validate_request_arg', ); } $args['signup_password'] = array( 'context' => array( 'edit' ), 'description' => __( 'New user account password.', 'buddyboss' ), 'type' => 'string', 'required' => true, 'sanitize_callback' => 'sanitize_text_field', 'validate_callback' => 'rest_validate_request_arg', ); if ( ( function_exists( 'bp_register_confirm_password' ) && false !== bp_register_confirm_password() ) || ! function_exists( 'bp_register_confirm_password' ) ) { $args['signup_password_confirm'] = array( 'context' => array( 'edit' ), 'description' => __( 'New user confirm account password.', 'buddyboss' ), 'type' => 'string', 'required' => true, 'sanitize_callback' => 'sanitize_text_field', 'validate_callback' => 'rest_validate_request_arg', ); } if ( bp_get_blog_signup_allowed() ) { $args['signup_with_blog'] = array( 'context' => array( 'edit' ), 'description' => __( 'If user likes to create a new site.', 'buddyboss' ), 'type' => 'boolean', 'sanitize_callback' => 'rest_sanitize_boolean', 'validate_callback' => 'rest_validate_request_arg', ); $args['signup_blog_url'] = array( 'context' => array( 'edit' ), 'description' => __( 'New Site URL.', 'buddyboss' ), 'type' => 'string', 'sanitize_callback' => 'sanitize_text_field', 'validate_callback' => 'rest_validate_request_arg', ); $args['signup_blog_title'] = array( 'context' => array( 'edit' ), 'description' => __( 'New Site Title.', 'buddyboss' ), 'type' => 'string', 'sanitize_callback' => 'sanitize_text_field', 'validate_callback' => 'rest_validate_request_arg', ); $args['signup_blog_privacy'] = array( 'context' => array( 'edit' ), 'description' => __( 'If user would like to site appear in search engines, and in public listings around this network.', 'buddyboss' ), 'type' => 'string', 'enum' => array( 'public', 'private' ), 'sanitize_callback' => 'sanitize_text_field', 'validate_callback' => 'rest_validate_request_arg', ); } } elseif ( WP_REST_Server::EDITABLE === $method ) { $key = 'update_item'; } elseif ( WP_REST_Server::DELETABLE === $method ) { $key = 'delete_item'; } /** * Filters the method query arguments. * * @param array $args Query arguments. * @param string $method HTTP method of the request. * * @since 0.1.0 */ return apply_filters( "bp_rest_signup_{$key}_query_arguments", $args, $method ); }
Changelog
Version | Description |
---|---|
0.1.0 | Introduced. |
Questions?
We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.