コード例 #1
0
/**
 * Mark notification read/unread for a user by ID.
 *
 * Used when clearing out notifications for a specific notification item.
 *
 * @since BuddyPress (1.9.0)
 *
 * @param int $id ID of the user whose notifications are being deleted.
 * @param int $is_new 0 for read, 1 for unread.
 * @return bool True on success, false on failure.
 */
function bp_notifications_mark_notification($id, $is_new = false)
{
    if (!bp_notifications_check_notification_access(bp_loggedin_user_id(), $id)) {
        return false;
    }
    return BP_Notifications_Notification::update(array('is_new' => $is_new), array('id' => $id));
}
コード例 #2
0
/**
 * Check if a user has access to a specific notification
 *
 * Used before deleting a notification for a user
 *
 * @deprecated Deprecated since BuddyPress 1.9.0. Use
 *  bp_notifications_check_notification_access() instead.
 *
 * @since BuddyPress (1.0)
 * @param int $user_id
 * @param int $notification_id
 * @return boolean True on success, false on fail
 */
function bp_core_check_notification_access($user_id, $notification_id)
{
    // Bail if notifications is not active
    if (!bp_is_active('notifications')) {
        return false;
    }
    // Trigger the deprecated function notice
    _deprecated_function(__FUNCTION__, '1.9', 'bp_notifications_check_notification_access()');
    return bp_notifications_check_notification_access($user_id, $notification_id);
}