Skip to:
Content
Pages
Categories
Search
Top
Bottom

Re: Notifications Relocation


Mike Pratt
Participant

@mikepratt

@LwEEs

You can also place this code anywhere you want and style your own little Notifications Block:

<!-- Notifications block -->
<?php
echo '<li id="notifications-menu"><span id="menu-title">
<a href="' . $bp->loggedin_user->domain . '">';
_e( 'Notifications', 'buddypress' );

if ( $notifications = bp_core_get_notifications_for_user( $bp->loggedin_user->id ) ) { ?>
<span><?php echo '('.count($notifications).')' ?></span>
<?php
}
echo '</a></span>';
echo '<ul>';

if ( $notifications ) { ?>
<?php $counter = 0; ?>
<?php for ( $i = 0; $i < count($notifications); $i++ ) { ?>
<?php $alt = ( 0 == $counter % 2 ) ? ' class="alt"' : ''; ?>
<li<?php echo $alt ?>><?php echo $notifications[$i] ?></li>
<?php $counter++; ?>
<?php } ?>
<?php } else { ?>
<li><a href="<?php echo $bp->loggedin_user->domain ?>">
<?php _e( 'No new notifications.', 'buddypress' ); ?></a></li>
<?php
}
echo '</ul>';
echo '</li>';
?>

Skip to toolbar