BP_Notifications_Notification::mark_all_by_type( int $item_id, int $is_new, string $component_name = '', string $component_action = '', int $secondary_item_id )

Mark all notifications for all users as read by item id, and optional secondary item id, and component name and action.


Parameters Parameters

$item_id

(int) (Required) The ID of the item associated with the notifications.

$is_new

(int) (Required) Mark as read (1) or unread (0).

$component_name

(string) (Optional) The component that the notifications are associated with.

Default value: ''

$component_action

(string) (Optional) The action that the notifications are associated with.

Default value: ''

$secondary_item_id

(int) (Optional) ID of the secondary associated item.


Top ↑

Return Return

(int|false)


Source Source

File: bp-notifications/classes/class-bp-notifications-notification.php

	public static function mark_all_by_type( $item_id, $is_new = 0, $component_name = '', $component_action = '', $secondary_item_id = 0 ) {

		// Values to be updated.
		$update_args = array(
			'is_new' => $is_new,
		);

		// WHERE clauses.
		$where_args = array(
			'item_id' => $item_id,
		);

		if ( ! empty( $component_name ) ) {
			$where_args['component_name'] = $component_name;
		}

		if ( ! empty( $component_action ) ) {
			$where_args['component_action'] = $component_action;
		}

		if ( ! empty( $secondary_item_id ) ) {
			$where_args['secondary_item_id'] = $secondary_item_id;
		}

		return self::update( $update_args, $where_args );
	}


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.