This function has been deprecated. Deprecated since BuddyPress 1.9.0. Use bp_notifications_add_notification() instead.

bp_core_add_notification( string $item_id, int $user_id, string $component_name, string $component_action, int $secondary_item_id, false|string $date_notified = false, int $is_new = 1 )

Add a notification for a specific user, from a specific component.

Description

Parameters

$item_id

(Required)

$user_id

(Required)

$component_name

(Required)

$component_action

(Required)

$secondary_item_id

(Required)

$date_notified

(Optional)

Default value: false

$is_new

(Optional)

Default value: 1

Return

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

Source

File: bp-core/deprecated/buddypress/1.9.php

function bp_core_add_notification( $item_id, $user_id, $component_name, $component_action, $secondary_item_id = 0, $date_notified = false, $is_new = 1 ) {

	// 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_add_notification()' );

	// Notifications must always have a time
	if ( false === $date_notified ) {
		$date_notified = bp_core_current_time();
	}

	// Add the notification
	return bp_notifications_add_notification( array(
		'item_id'           => $item_id,
		'user_id'           => $user_id,
		'component_name'    => $component_name,
		'component_action'  => $component_action,
		'secondary_item_id' => $secondary_item_id,
		'date_notified'     => $date_notified,
		'is_new'            => $is_new
	) );
}

Changelog

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