BP_REST_Members_Actions_Endpoint::register_routes()

Register the component routes.

Description

Source

File: bp-members/classes/class-bp-rest-members-actions-endpoint.php

	public function register_routes() {
		register_rest_route(
			$this->namespace,
			'/' . $this->rest_base . '/(?P<id>[\d]+)',
			array(
				'args'   => array(
					'id'     => array(
						'description' => __( 'A unique numeric ID for the member.', 'buddyboss' ),
						'type'        => 'integer',
					),
					'action' => array(
						'description'       => __( 'Action name which you want to perform for the member.', 'buddyboss' ),
						'type'              => 'string',
						'enum'              => apply_filters( 'bp_rest_members_action_enum_args', array( 'follow', 'unfollow' ) ),
						'validate_callback' => 'rest_validate_request_arg',
					),
				),
				array(
					'methods'             => WP_REST_Server::EDITABLE,
					'callback'            => array( $this, 'update_item' ),
					'permission_callback' => array( $this, 'update_item_permissions_check' ),
				),
				'schema' => array( $this, 'get_item_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.