Re: How to re-produce Notifications in a Custom Admin bar?
I tried this, doesn’t print anything neaither:
<ul id="user-menu">
<li><a href="<?php echo bp_loggedin_user_domain() ?>/profile/edit/">My profile</a></li>
<li>| <a href="<?php echo bp_loggedin_user_domain() ?>/messages/">My messages</a></li>
<li>| <a href="<?php echo bp_loggedin_user_domain() ?>/groups/">My groups</a></li>
<li>| <a href="<?php echo bp_loggedin_user_domain() ?>/friends/">My friends</a></li>
<li>| <a href="<?php echo bp_loggedin_user_domain() ?>/photos/">My photos</a></li>
<li>| <a href="<?php echo bp_loggedin_user_domain() ?>/settings/">Settings</a></li>
<?php function my_bp_adminbar_notifications_menu() {
global $bp;
if ( !is_user_logged_in() )
return false;
echo '<li id="bp-adminbar-notifications-menu"><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>';
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>';
}
?>
<?php if( function_exists('my_bp_adminbar_notifications_menu') ) my_bp_adminbar_notifications_menu(); ?>
</ul>
Is anything in there correct?