BP_REST_Notifications_Endpoint::get_notification_object( WP_REST_Request $request )

Get notification object.

Description

Parameters

$request

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

Return

(BP_Notifications_Notification|string) A notification object.

Source

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

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

		$notification = bp_notifications_get_notification( $notification_id );

		if ( empty( $notification->id ) ) {
			return '';
		}

		return $notification;
	}

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.