Advertisement
Guest User

r-a-y

a guest
Mar 8th, 2010
352
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.01 KB | None | 0 0
  1. <?php
  2. function widget_bpNotificationWidget($args) {
  3. extract($args);
  4.  
  5. global $bp;
  6.  
  7. if(is_user_logged_in()) :
  8. echo $before_widget;
  9. echo $before_title;
  10. _e( 'Notifications', 'buddypress' );
  11.  
  12. if ( $notifications = bp_core_get_notifications_for_user( $bp->loggedin_user->id ) ) { ?>
  13. <span>(<?php echo count($notifications) ?>)</span>
  14. <?php
  15. }
  16. echo $after_title;
  17.  
  18. echo '<ul>';
  19.  
  20. if ( $notifications ) { ?>
  21. <?php $counter = 0; ?>
  22. <?php for ( $i = 0; $i < count($notifications); $i++ ) { ?>
  23. <?php $alt = ( 0 == $counter % 2 ) ? ' class="alt"' : ''; ?>
  24. <li<?php echo $alt ?>><?php echo $notifications[$i] ?></li>
  25. <?php $counter++; ?>
  26. <?php } ?>
  27. <?php } else { ?>
  28. <li><a href="<?php echo $bp->loggedin_user->domain ?>"><?php _e( 'No new notifications.', 'buddypress' ); ?></a></li>
  29. <?php
  30. }
  31.  
  32. echo '</ul>';
  33. ?>
  34. <?php echo $after_widget; ?>
  35. <?php
  36. endif;
  37. }
  38. register_sidebar_widget('BP-NotificationWidget', 'widget_bpNotificationWidget');
  39. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement