Bp_List_Newest_Members_Widget

The BP List Newest members Bp List Newest Members Widget class.

Defined (1)

The class is defined in the following location(s).

/list-newest-members-for-bp.php  
  1. class Bp_List_Newest_Members_Widget extends WP_Widget { 
  2.  
  3. function bp_list_newest_members_widget() { 
  4. $widget_ops = array('classname' => 'widget_list_newest_members', 'description' => __( "List Photos And Names Of The Newest Registered Members", "bp-list-newest-members") ); 
  5.  
  6.  
  7. parent::WP_Widget( false, __('Newest Members', 'bp-list-newest-members'), $widget_ops);  
  8.  
  9. function widget($args, $instance) { 
  10. global $bp; 
  11.  
  12. extract( $args ); 
  13.  
  14. echo $before_widget; 
  15. echo $before_title 
  16. .$instance['title'] 
  17. . $after_title; ?> 
  18.  
  19. <?php if ( bp_has_members( 'user_id=0&type=newest&max='. $instance['max_num'] .'&populate_extras=0' ) ) : ?> 
  20. <ul id="members-list" class="item-list"> 
  21. <?php while ( bp_members() ) : bp_the_member(); ?> 
  22. <li> 
  23. <div class="item-avatar"> 
  24. <a href="<?php bp_member_permalink() ?>"><?php bp_member_avatar('type=full&width=40&height=40') ?></a></div> 
  25. <div class="item"> 
  26. <div class="item-title"> 
  27. <a href="<?php bp_member_permalink() ?>"><?php bp_member_name() ?></a> 
  28. <div class="clear"></div></div> 
  29. <?php endwhile; ?> 
  30. </div> 
  31.  
  32. <?php else: ?> 
  33.  
  34. <div class="widget-error"> 
  35. <?php _e( 'Sorry no newest member ', 'bp-list-newest-members' ) ?> 
  36. </ul></div> 
  37.  
  38. <?php endif; ?> 
  39.  
  40. <?php echo $after_widget; ?> 
  41.  
  42. <?php 
  43.  
  44. function update( $new_instance, $old_instance ) { 
  45. $instance = $old_instance; 
  46. $instance['title'] = strip_tags( $new_instance['title'] ); 
  47. $instance['max_num'] = strip_tags( $new_instance['max_num'] ); 
  48.  
  49. return $instance; 
  50.  
  51. function form( $instance ) { 
  52. $instance = wp_parse_args( (array) $instance, array( 'max_num' => 5 ) ); 
  53. $title = strip_tags( $instance['title'] ); 
  54. $max_num = strip_tags( $instance['max_num'] ); 
  55. ?> 
  56.  
  57.  
  58. <p><label for="bp-list-newest-members-widget-title"><?php _e( 'Title' , 'bp-list-newest-members'); ?> 
  59. <input type="text" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" class="widefat" value="<?php echo esc_attr( $title ); ?>"style="width: 100%"/></label></p> 
  60.  
  61. <p><label for="bp-list-newest-members-widget-max-num"><?php _e( 'Max Number of Members:', 'bp-list-newest-members' ); ?> <input class="widefat" id="<?php echo $this->get_field_id( 'max_num' ); ?>" name="<?php echo $this->get_field_name( 'max_num' ); ?>" type="text" value="<?php echo attribute_escape( $max_num ); ?>" style="width: 30%" /></label></p> 
  62.  
  63.  
  64.  
  65. <?php