BP_REST_Activity_Endpoint::get_activity_object( WP_REST_Request $request )

Get activity object.

Description

Parameters

$request

(Required) Full details about the request.

Return

(BP_Activity_Activity|string) An activity object.

Source

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

	public function get_activity_object( $request ) {
		$activity_id = is_numeric( $request ) ? $request : (int) $request['id'];

		$activity = bp_activity_get_specific(
			array(
				'activity_ids'     => array( $activity_id ),
				'display_comments' => true,
			)
		);

		if ( is_array( $activity ) && ! empty( $activity['activities'][0] ) ) {
			return $activity['activities'][0];
		}

		return '';
	}

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.