Warning: This function has been deprecated.

bp_notifications_buddybar_menu()

Create the Notifications menu for the BuddyBar.


Description Description


Source Source

File: bp-core/deprecated/2.1.php

function bp_notifications_buddybar_menu() {

	if ( ! is_user_logged_in() ) {
		return false;
	}

	echo '<li id="bp-adminbar-notifications-menu"><a href="' . esc_url( bp_loggedin_user_domain() ) . '">';
	_e( 'Notifications', 'buddypress' );

	$notification_count = bp_notifications_get_unread_notification_count( bp_loggedin_user_id() );
	$notifications      = bp_notifications_get_notifications_for_user( bp_loggedin_user_id() );

	if ( ! empty( $notification_count ) ) : ?>
		<span><?php echo bp_core_number_format( $notification_count ); ?></span>
	<?php
	endif;

	echo '</a>';
	echo '<ul>';

	if ( ! empty( $notifications ) ) {
		$counter = 0;
		for ( $i = 0, $count = count( $notifications ); $i < $count; ++$i ) {
			$alt = ( 0 == $counter % 2 ) ? ' class="alt"' : ''; ?>

			<li<?php echo $alt ?>><?php echo $notifications[$i] ?></li>

			<?php $counter++;
		}
	} else { ?>

		<li><a href="<?php echo esc_url( bp_loggedin_user_domain() ); ?>"><?php _e( 'No new notifications.', 'buddypress' ); ?></a></li>

	<?php
	}

	echo '</ul>';
	echo '</li>';
}

Top ↑

Changelog Changelog

Changelog
Version Description
2.1.0 This function has been deprecated.
1.9.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.