bp_nouveau_add_notice_notification_for_user( $notifications,  $user_id )

Add notice notification for member.

Description

Source

File: bp-templates/bp-nouveau/includes/messages/functions.php

function bp_nouveau_add_notice_notification_for_user( $notifications, $user_id ) {
	if ( ! bp_is_active( 'messages' ) || ! doing_action( 'admin_bar_menu' ) ) {
		return $notifications;
	}

	$notice = BP_Messages_Notice::get_active();
	if ( empty( $notice->id ) ) {
		return $notifications;
	}

	$closed_notices = bp_get_user_meta( $user_id, 'closed_notices', true );
	if ( empty( $closed_notices ) ) {
		$closed_notices = array();
	}

	if ( in_array( $notice->id, $closed_notices, true ) ) {
		return $notifications;
	}

	$notice_notification                    = new stdClass;
	$notice_notification->id                = 0;
	$notice_notification->user_id           = $user_id;
	$notice_notification->item_id           = $notice->id;
	$notice_notification->secondary_item_id = '';
	$notice_notification->component_name    = 'messages';
	$notice_notification->component_action  = 'new_notice';
	$notice_notification->date_notified     = $notice->date_sent;
	$notice_notification->is_new            = '1';

	return array_merge( $notifications, array( $notice_notification ) );
}

Changelog

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