Advertisement
Guest User

Untitled

a guest
Apr 9th, 2016
200
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.94 KB | None | 0 0
  1. /**
  2. * Add Notification number to template
  3. */
  4. function my_bp_adminbar_notifications_menu() {
  5. global $bp;
  6.  
  7. if ( !is_user_logged_in() )
  8. return false;
  9.  
  10. echo '<div class="notices"><ul class="notices">';
  11. _e( '', 'buddypress' );
  12.  
  13. if ( $notifications = bp_notifications_get_notifications_for_user( $bp->loggedin_user->id ) ) { ?>
  14. <li class="parent"><span class="notice-badge"><?php echo count( $notifications ) ?></span>
  15. <?php
  16. }
  17.  
  18. echo '</a>';
  19. echo '<ul class="sub-menu">';
  20.  
  21. if ( $notifications ) {
  22. $counter = 0;
  23. for ( $i = 0; $i < count($notifications); $i++ ) {
  24. $alt = ( 0 == $counter % 2 ) ? ' class="alt"' : ''; ?>
  25.  
  26. <li<?php echo $alt ?>><?php echo $notifications[$i] ?></li>
  27.  
  28. <?php $counter++;
  29. }
  30. } else { ?>
  31.  
  32. <li><a href="<?php echo $bp->loggedin_user->domain ?>"><?php _e( '<div class="icon"></div>', 'buddypress' ); ?></a></li>
  33.  
  34. <?php
  35. }
  36.  
  37. echo '</ul></li>';
  38. echo '</ul></div>';
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement