BP_REST_XProfile_Data_Endpoint::get_item_schema()

Get the XProfile data schema, conforming to JSON Schema.

Description

Return

(array)

Source

File: bp-xprofile/classes/class-bp-rest-xprofile-data-endpoint.php

603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
public function get_item_schema() {
    $schema = array(
        '$schema'    => 'http://json-schema.org/draft-04/schema#',
        'title'      => 'bp_xprofile_data',
        'type'       => 'object',
        'properties' => array(
            'id'           => array(
                'context'     => array( 'embed', 'view', 'edit' ),
                'description' => __( 'A unique numeric ID for the profile data.', 'buddyboss' ),
                'readonly'    => true,
                'type'        => 'integer',
            ),
            'field_id'     => array(
                'context'     => array( 'embed', 'view', 'edit' ),
                'description' => __( 'The ID of the field the data is from.', 'buddyboss' ),
                'readonly'    => true,
                'type'        => 'integer',
            ),
            'user_id'      => array(
                'context'     => array( 'embed', 'view', 'edit' ),
                'description' => __( 'The ID of the user the field data is from.', 'buddyboss' ),
                'readonly'    => true,
                'type'        => 'integer',
            ),
            'value'        => array(
                'context'     => array( 'embed', 'view', 'edit' ),
                'description' => __( 'The value of the field data.', 'buddyboss' ),
                'type'        => 'object',
                'arg_options' => array(
                    'sanitize_callback' => null,
                    'validate_callback' => null,
                ),
                'properties'  => array(
                    'raw'          => array(
                        'description' => __( 'Value for the field, as it exists in the database.', 'buddyboss' ),
                        'type'        => 'string',
                        'context'     => array( 'edit' ),
                    ),
                    'unserialized' => array(
                        'description' => __( 'Unserialized value for the field, regular string will be casted as array.', 'buddyboss' ),
                        'type'        => 'array',
                        'context'     => array( 'embed', 'view', 'edit' ),
                        'items'       => array(
                            'type' => 'string',
                        ),
                        'readonly'    => true,
                    ),
                    'rendered'     => array(
                        'description' => __( 'HTML value for the field, transformed for display.', 'buddyboss' ),
                        'type'        => 'string',
                        'context'     => array( 'embed', 'view', 'edit' ),
                        'readonly'    => true,
                    ),
                ),
            ),
            'last_updated' => array(
                'context'     => array( 'embed', 'view', 'edit' ),
                'description' => __( 'The date the field data was last updated, in the site\'s timezone.', 'buddyboss' ),
                'type'        => 'string',
                'format'      => 'date-time',
            ),
        ),
    );
 
    /**
     * Filters the xprofile data schema.
     *
     * @param array $schema The endpoint schema.
     */
    return apply_filters( 'bp_rest_xprofile_data_schema', $this->add_additional_fields_schema( $schema ) );
}

Changelog

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.