bp_notifications_get_meta( int $notification_id, string $meta_key = '', bool $single = true )

Get metadata for a given notification item.


Parameters Parameters

$notification_id

(int) (Required) ID of the notification item whose metadata is being requested.

$meta_key

(string) (Optional) If present, only the metadata matching that meta key will be returned. Otherwise, all metadata for the notification item will be fetched.

Default value: ''

$single

(bool) (Optional) If true, return only the first value of the specified meta_key. This parameter has no effect if meta_key is not specified. Default: true.

Default value: true


Top ↑

Return Return

(mixed) The meta value(s) being requested.


Source Source

File: bp-notifications/bp-notifications-functions.php

function bp_notifications_get_meta( $notification_id = 0, $meta_key = '', $single = true ) {
	add_filter( 'query', 'bp_filter_metaid_column_name' );
	$retval = get_metadata( 'notification', $notification_id, $meta_key, $single );
	remove_filter( 'query', 'bp_filter_metaid_column_name' );

	/**
	 * Filters the metadata for a specified notification item.
	 *
	 * @since 2.3.0
	 *
	 * @param mixed  $retval          The meta values for the notification item.
	 * @param int    $notification_id ID of the notification item.
	 * @param string $meta_key        Meta key for the value being requested.
	 * @param bool   $single          Whether to return one matched meta key row or all.
	 */
	return apply_filters( 'bp_notifications_get_meta', $retval, $notification_id, $meta_key, $single );
}


Top ↑

Changelog Changelog

Changelog
Version Description
2.3.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.