Guest User

Notification widget

a guest
Aug 9th, 2010
378
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  1. <?php
  2. class BP_Notification_Widget extends WP_Widget {
  3. function bp_notification_widget() {
  4. parent::WP_Widget( false, $name = __( 'Notifications', 'buddypress' ) );
  5. }
  6.  
  7. function widget($args) {
  8. global $bp;
  9. extract( $args );
  10. echo $before_widget;
  11. echo $before_title
  12. . $widget_name
  13. . $after_title;
  14. if ( $notifications = bp_core_get_notifications_for_user( bp_loggedin_user_id() ) ) {
  15.  
  16. echo '<ul>';
  17.  
  18. if ( $notifications ) {
  19. $counter = 0;
  20. for ( $i = 0; $i < count($notifications); $i++ ) {
  21. echo '<li>'.$notifications[$i].'</li>';
  22. }
  23. }
  24.  
  25. echo '</ul>';
  26. }
  27.  
  28. }
  29. }
  30. add_action('widgets_init', create_function('', 'return register_widget("BP_Notification_Widget");') );
Advertisement
Add Comment
Please, Sign In to add comment