BP_REST_Group_Membership_Endpoint::get_item_schema()

Get the group member schema, conforming to JSON Schema.

Description

Return

(array)

Source

File: bp-groups/classes/class-bp-rest-group-membership-endpoint.php

986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
public function get_item_schema() {
 
    // Get schema from members.
    $schema = $this->members_endpoint->get_item_schema();
 
    // Set title to this endpoint.
    $schema['title'] = 'bp_group_members';
 
    $schema['properties']['is_mod'] = array(
        'context'     => array( 'view', 'edit' ),
        'description' => __( 'Whether the member is a group moderator.', 'buddyboss' ),
        'type'        => 'boolean',
    );
 
    $schema['properties']['is_banned'] = array(
        'context'     => array( 'view', 'edit' ),
        'description' => __( 'Whether the member has been banned from the group.', 'buddyboss' ),
        'type'        => 'boolean',
    );
 
    $schema['properties']['is_admin'] = array(
        'context'     => array( 'view', 'edit' ),
        'description' => __( 'Whether the member is a group administrator.', 'buddyboss' ),
        'type'        => 'boolean',
    );
 
    $schema['properties']['is_confirmed'] = array(
        'context'     => array( 'view', 'edit' ),
        'description' => __( 'Whether the membership of this user has been confirmed.', 'buddyboss' ),
        'type'        => 'boolean',
    );
 
    $schema['properties']['date_modified'] = array(
        'context'     => array( 'view', 'edit' ),
        'description' => __( "The date of the last time the membership of this user was modified, in the site's timezone.", 'buddyboss' ),
        'type'        => 'string',
        'format'      => 'date-time',
    );
 
    $schema['properties']['role'] = array(
        'context'     => array( 'view', 'edit' ),
        'description' => __( 'Current member\'s role label in the group.', 'buddyboss' ),
        'type'        => 'string',
        'readonly'    => true,
    );
 
    $schema['properties']['plural_role'] = array(
        'context'     => array( 'view', 'edit' ),
        'description' => __( 'Current member\'s role label in the plural form in the group.', 'buddyboss' ),
        'type'        => 'string',
        'readonly'    => true,
    );
 
    /**
     * Filters the group membership schema.
     *
     * @param array $schema The endpoint schema.
     */
    return apply_filters( 'bp_rest_group_members_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.