BP_REST_Members_Actions_Endpoint::get_item_schema()
Get the members action schema, conforming to JSON Schema.
Description
Return
(array)
Source
File: bp-members/classes/class-bp-rest-members-actions-endpoint.php
public function get_item_schema() { $schema = array( '$schema' => 'http://json-schema.org/draft-04/schema#', 'title' => 'bp_members_action', 'type' => 'object', 'properties' => array( 'action' => array( 'description' => __( 'Action performed or not.', 'buddyboss' ), 'type' => 'boolean', 'context' => array( 'edit' ), 'readonly' => true, ), 'data' => array( 'description' => __( 'Object of member.', 'buddyboss' ), 'type' => 'object', 'context' => array( 'edit' ), 'readonly' => true, 'properties' => array( 'id' => array( 'description' => __( 'A unique numeric ID for the Member.', 'buddyboss' ), 'type' => 'integer', 'context' => array( 'embed', 'view', 'edit' ), 'readonly' => true, ), 'name' => array( 'description' => __( 'Display name for the member.', 'buddyboss' ), 'type' => 'string', 'context' => array( 'embed', 'view', 'edit' ), 'arg_options' => array( 'sanitize_callback' => 'sanitize_text_field', ), ), 'mention_name' => array( 'description' => __( 'The name used for that user in @-mentions.', 'buddyboss' ), 'type' => 'string', 'context' => array( 'embed', 'view', 'edit' ), 'arg_options' => array( 'sanitize_callback' => 'sanitize_text_field', ), ), 'link' => array( 'description' => __( 'Profile URL of the member.', 'buddyboss' ), 'type' => 'string', 'format' => 'uri', 'context' => array( 'embed', 'view', 'edit' ), 'readonly' => true, ), 'user_login' => array( 'description' => __( 'An alphanumeric identifier for the Member.', 'buddyboss' ), 'type' => 'string', 'context' => array( 'embed', 'view', 'edit' ), 'required' => true, 'arg_options' => array( 'sanitize_callback' => array( $this, 'check_username' ), ), ), 'member_types' => array( 'description' => __( 'Member types associated with the member.', 'buddyboss' ), 'type' => 'object', 'context' => array( 'embed', 'view', 'edit' ), 'readonly' => true, ), 'xprofile' => array( 'description' => __( 'Member XProfile groups and its fields.', 'buddyboss' ), 'type' => 'array', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'friendship_status' => array( 'description' => __( 'Friendship relation with, current, logged in user.', 'buddyboss' ), 'type' => 'string', 'context' => array( 'embed', 'view', 'edit' ), 'readonly' => true, 'enum' => array( 'is_friends', 'not_friends', 'pending', 'awaiting_response' ), ), 'is_following' => array( 'description' => __( 'Check if a user is following or not.', 'buddyboss' ), 'type' => 'boolean', 'context' => array( 'embed', 'view', 'edit' ), 'readonly' => true, ), ), ), ), ); // Avatars. if ( true === buddypress()->avatar->show_avatars ) { $avatar_properties = array(); $avatar_properties['full'] = array( /* translators: Full image size for the member Avatar */ 'description' => sprintf( __( 'Avatar URL with full image size (%1$d x %2$d pixels).', 'buddyboss' ), number_format_i18n( bp_core_avatar_full_width() ), number_format_i18n( bp_core_avatar_full_height() ) ), 'type' => 'string', 'format' => 'uri', 'context' => array( 'embed', 'view', 'edit' ), ); $avatar_properties['thumb'] = array( /* translators: Thumb imaze size for the member Avatar */ 'description' => sprintf( __( 'Avatar URL with thumb image size (%1$d x %2$d pixels).', 'buddyboss' ), number_format_i18n( bp_core_avatar_thumb_width() ), number_format_i18n( bp_core_avatar_thumb_height() ) ), 'type' => 'string', 'format' => 'uri', 'context' => array( 'embed', 'view', 'edit' ), ); $schema['properties']['data']['avatar_urls'] = array( 'description' => __( 'Avatar URLs for the member.', 'buddyboss' ), 'type' => 'object', 'context' => array( 'embed', 'view', 'edit' ), 'readonly' => true, 'properties' => $avatar_properties, ); } $schema['properties']['data']['cover_url'] = array( 'description' => __( 'Cover images URL for the member.', 'buddyboss' ), 'type' => 'string', 'context' => array( 'embed', 'view', 'edit' ), 'readonly' => true, ); /** * Filters the members action schema. * * @param array $schema The endpoint schema. */ return apply_filters( 'bp_rest_members_action_schema', $this->add_additional_fields_schema( $schema ) ); }
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.