bp_notifications_clear_all_for_user_cache_before_update( array $update_args, array $where_args )

Invalidates ‘all_for_user_’ cache when updating.

Description

Parameters

$update_args

(array) (Required) See BP_Notifications_Notification::update() for description.

$where_args

(array) (Required) See BP_Notifications_Notification::update() for description.

Source

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

function bp_notifications_clear_all_for_user_cache_before_update( $update_args, $where_args ) {

	// User ID is passed in where arugments.
	if ( ! empty( $where_args['user_id'] ) ) {
		bp_notifications_clear_all_for_user_cache( $where_args['user_id'] );

	// Get user ID from Notification ID.
	} elseif ( ! empty( $where_args['id'] ) ) {
		$n = bp_notifications_get_notification( $where_args['id'] );
		bp_notifications_clear_all_for_user_cache( $n->user_id );
	}
}

Changelog

Changelog
Version Description
BuddyPress 2.3.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.