bp_notifications_mark_notification( int $id, int|bool $is_new = false )
Mark notification read/unread for a user by ID.
Description
Used when clearing out notifications for a specific notification item.
Parameters
- $id
-
(Required) ID of the notification.
- $is_new
-
(Optional) 0 for read, 1 for unread.
Default value: false
Return
(false|int) True on success, false on failure.
Source
File: bp-notifications/bp-notifications-functions.php
function bp_notifications_mark_notification( $id, $is_new = false ) {
if ( ! bp_notifications_check_notification_access( bp_displayed_user_id(), $id ) ) {
return false;
}
return BP_Notifications_Notification::update(
array( 'is_new' => $is_new ),
array( 'id' => $id )
);
}
Changelog
| Version | Description |
|---|---|
| BuddyPress 1.9.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.