bp_notifications_mark_notifications_from_user( int $user_id, string $component_name, string $component_action, int|bool $is_new = false )

Mark all notifications read/unread from a user.


Description Description

Used when clearing out all notifications for a user, when deleted or spammed.


Top ↑

Parameters Parameters

$user_id

(int) (Required) ID of the user whose associated items are being deleted.

$component_name

(string) (Required) Name of the associated component.

$component_action

(string) (Required) Name of the associated action.

$is_new

(int|bool) (Optional) 0 for read, 1 for unread.

Default value: false


Top ↑

Return Return

(int|false) True on success, false on failure.


Source Source

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

function bp_notifications_mark_notifications_from_user( $user_id, $component_name, $component_action, $is_new = false ) {
	return BP_Notifications_Notification::update(
		array(
			'is_new' => $is_new
		),
		array(
			'item_id'          => $user_id,
			'component_name'   => $component_name,
			'component_action' => $component_action
		)
	);
}


Top ↑

Changelog Changelog

Changelog
Version Description
1.9.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

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