BP_REST_Topics_Actions_Endpoint::action_items( WP_REST_Request $request )
Actions on Topic
Description
Parameters
- $request
-
(Required) Full details about the request.
Return
(WP_REST_Response) | WP_Error
Source
File: bp-forums/classes/class-bp-rest-topics-actions-endpoint.php
public function action_items( $request ) { $action = $request->get_param( 'action' ); $value = $request->get_param( 'value' ); $topic_id = $request->get_param( 'id' ); $user_id = bbp_get_user_id( 0, true, true ); $retval = ''; switch ( $action ) { case 'favorite': $retval = $this->rest_update_favorite( $topic_id, $value, $user_id ); break; case 'subscribe': $retval = $this->rest_update_subscribe( $topic_id, $value, $user_id ); break; case 'close': $retval = $this->rest_update_close( $topic_id, $value ); break; case 'sticky': case 'super_sticky': $retval = $this->rest_update_sticky( $topic_id, $action, $value ); break; case 'spam': $retval = $this->rest_update_spam( $topic_id, $value ); break; case 'trash': $retval = $this->rest_update_trash( $topic_id, $value ); break; } if ( is_wp_error( $retval ) ) { return $retval; } return $this->get_item( array( 'id' => $topic_id, 'context' => 'view', ) ); }
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.