BP_REST_Reply_Actions_Endpoint::action_items( WP_REST_Request $request )

Actions on Reply.

Description

Parameters

$request

(WP_REST_Request) (Required) Full details about the request.

Return

(WP_REST_Response) | WP_Error

Source

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

	public function action_items( $request ) {

		$action   = $request->get_param( 'action' );
		$value    = $request->get_param( 'value' );
		$reply_id = $request->get_param( 'id' );
		$retval   = '';

		switch ( $action ) {
			case 'spam':
				$retval = $this->rest_update_reply_spam( $reply_id, $value );
				break;
			case 'trash':
				$retval = $this->rest_update_reply_trash( $reply_id, $value );
				break;
		}

		if ( is_wp_error( $retval ) ) {
			return $retval;
		}

		return $this->get_item(
			array(
				'id'      => $reply_id,
				'context' => 'view',
			)
		);
	}

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.