BP_REST_Group_Settings_Endpoint::register_routes()
Register the component routes.
Description
Source
File: bp-groups/classes/class-bp-rest-group-settings-endpoint.php
public function register_routes() {
if ( bp_is_active( 'forums' ) && function_exists( 'bbp_is_group_forums_active' ) && bbp_is_group_forums_active() ) {
$this->nav[] = 'forum';
}
if ( function_exists( 'bp_ld_sync' ) ) {
$va = bp_ld_sync( 'settings' )->get( 'buddypress.enabled', true );
if ( '1' === $va ) {
$this->nav[] = 'courses';
}
}
register_rest_route(
$this->namespace,
'/' . $this->rest_base . '/(?P<id>[\d]+)/settings',
array(
'args' => array(
'id' => array(
'description' => __( 'A unique numeric ID for the Group.', 'buddyboss' ),
'type' => 'integer',
),
'nav' => array(
'description' => __( 'Navigation item slug.', 'buddyboss' ),
'type' => 'string',
'required' => true,
'enum' => $this->nav,
'sanitize_callback' => 'sanitize_key',
'validate_callback' => 'rest_validate_request_arg',
),
),
array(
'methods' => WP_REST_Server::READABLE,
'callback' => array( $this, 'get_item' ),
'permission_callback' => array( $this, 'get_item_permissions_check' ),
),
array(
'methods' => WP_REST_Server::EDITABLE,
'callback' => array( $this, 'update_item' ),
'permission_callback' => array( $this, 'update_item_permissions_check' ),
'args' => $this->get_endpoint_args_for_item_schema( WP_REST_Server::EDITABLE ),
),
'schema' => array( $this, 'get_item_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.