BP_REST_Activity_Endpoint::bp_rest_activity_content_validate( WP_REST_Request $request )

Validate

Description

Parameters

$request

(Required) Full details about the request.

Return

(int|mixed)

Source

File: bp-activity/classes/class-bp-rest-activity-endpoint.php

	public function bp_rest_activity_content_validate( $request ) {
		$toolbar_option = false;

		if ( ! empty( $request['content'] ) ) {
			return false;
		}

		// check activity toolbar options if one of them is set, activity can be empty.
		if (
			bp_is_active( 'media' )
			&& empty( $request['bp_media_ids'] )
			&& (
				! empty( $request['media_gif'] )
				&& (
					empty( $request['media_gif']['url'] )
					|| empty( $request['media_gif']['mp4'] )
				)
			)
		) {
			$toolbar_option = true;
		}

		return $toolbar_option;
	}

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.