BP_REST_XProfile_Update_Endpoint::get_collection_params()
Get the query params for the XProfile updates.
Description
Return
(array)
Source
File: bp-xprofile/classes/class-bp-rest-xprofile-update-endpoint.php
public function get_collection_params() { $params = parent::get_collection_params(); $params['context']['default'] = 'edit'; $params['fields'] = array( 'description' => __( 'Fields array with field_id, group_id, type, value and visibility_level to update the data.', 'buddyboss' ), 'type' => 'array', 'items' => array( 'type' => 'object' ), 'default' => array( array( 'field_id' => '', 'group_id' => '', 'value' => '', 'visibility_level' => '', ), ), 'required' => true, 'properties' => array( 'field_id' => array( 'description' => __( 'The ID of the field the data is from.', 'buddyboss' ), 'type' => 'integer', 'required' => true, 'sanitize_callback' => 'absint', 'validate_callback' => 'rest_validate_request_arg', ), 'group_id' => array( 'description' => __( 'ID of the profile group of fields that have profile fields', 'buddyboss' ), 'default' => 0, 'type' => 'integer', 'sanitize_callback' => 'absint', 'validate_callback' => 'rest_validate_request_arg', ), 'value' => array( 'description' => __( 'The value of the field data.', 'buddyboss' ), ), 'visibility_level' => array( 'description' => __( 'Who may see the saved value for this profile field.', 'buddyboss' ), 'default' => 'public', 'type' => 'string', 'enum' => array_keys( bp_xprofile_get_visibility_levels() ), ), ), ); $params['profile_group_id'] = array( 'description' => __( 'ID of the field group that have fields.', 'buddyboss' ), 'default' => 0, 'type' => 'integer', 'sanitize_callback' => 'absint', 'validate_callback' => 'rest_validate_request_arg', ); $params['hide_empty_groups'] = array( 'description' => __( 'Whether to hide profile groups of fields that do not have any profile fields or not.', 'buddyboss' ), 'default' => false, 'type' => 'boolean', 'sanitize_callback' => 'rest_sanitize_boolean', 'validate_callback' => 'rest_validate_request_arg', ); $params['member_type'] = array( 'description' => __( 'Limit fields by those restricted to a given member type, or array of member types. If `$user_id` is provided, the value of `$member_type` will be overridden by the member types of the provided user. The special value of \'any\' will return only those fields that are unrestricted by member type - i.e., those applicable to any type.', 'buddyboss' ), 'default' => array(), 'type' => 'array', 'items' => array( 'type' => 'string' ), 'sanitize_callback' => 'bp_rest_sanitize_member_types', 'validate_callback' => 'bp_rest_validate_member_types', ); $params['hide_empty_fields'] = array( 'description' => __( 'Whether to hide profile groups of fields that do not have any profile fields or not.', 'buddyboss' ), 'default' => false, 'type' => 'boolean', 'sanitize_callback' => 'rest_sanitize_boolean', 'validate_callback' => 'rest_validate_request_arg', ); $params['fetch_fields'] = array( 'description' => __( 'Whether to fetch the fields for each group.', 'buddyboss' ), 'default' => true, 'type' => 'boolean', 'sanitize_callback' => 'rest_sanitize_boolean', 'validate_callback' => 'rest_validate_request_arg', ); $params['fetch_field_data'] = array( 'description' => __( 'Whether to fetch data for each field. Requires a $user_id.', 'buddyboss' ), 'default' => true, 'type' => 'boolean', 'sanitize_callback' => 'rest_sanitize_boolean', 'validate_callback' => 'rest_validate_request_arg', ); $params['fetch_visibility_level'] = array( 'description' => __( 'Whether to fetch the visibility level for each field.', 'buddyboss' ), 'default' => true, 'type' => 'boolean', 'sanitize_callback' => 'rest_sanitize_boolean', 'validate_callback' => 'rest_validate_request_arg', ); $params['exclude_groups'] = array( 'description' => __( 'Ensure result set excludes specific profile field groups.', 'buddyboss' ), 'default' => array(), 'type' => 'array', 'items' => array( 'type' => 'integer' ), 'sanitize_callback' => 'bp_rest_sanitize_string_list', 'validate_callback' => 'rest_validate_request_arg', ); $params['exclude_fields'] = array( 'description' => __( 'Ensure result set excludes specific profile fields.', 'buddyboss' ), 'default' => array(), 'type' => 'array', 'items' => array( 'type' => 'string' ), 'sanitize_callback' => 'bp_rest_sanitize_string_list', 'validate_callback' => 'rest_validate_request_arg', ); $params['update_meta_cache'] = array( 'description' => __( 'Whether to pre-fetch xprofilemeta for all retrieved groups, fields, and data.', 'buddyboss' ), 'default' => true, 'type' => 'boolean', 'sanitize_callback' => 'rest_sanitize_boolean', 'validate_callback' => 'rest_validate_request_arg', ); /** * Filters the collection query params. * * @param array $params Query params. */ return apply_filters( 'bp_rest_xprofile_update_collection_params', $params ); }
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.