Changeset 10322 for trunk/src/bp-members/bp-members-widgets.php
- Timestamp:
- 11/02/2015 01:58:52 AM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-members/bp-members-widgets.php
r10276 r10322 35 35 public function __construct() { 36 36 37 // Setup widget name & description 37 // Setup widget name & description. 38 38 $name = _x( '(BuddyPress) Members', 'widget name', 'buddypress' ); 39 39 $description = __( 'A dynamic list of recently active, popular, and newest members', 'buddypress' ); 40 40 41 // Call WP_Widget constructor 41 // Call WP_Widget constructor. 42 42 parent::__construct( false, $name, array( 43 43 'description' => $description, … … 45 45 ) ); 46 46 47 // Maybe enqueue JS for widget 47 // Maybe enqueue JS for widget. 48 48 if ( is_active_widget( false, false, $this->id_base ) && ! is_admin() && ! is_network_admin() ) { 49 49 wp_enqueue_script( 'bp-widget-members' ); … … 61 61 public function widget( $args, $instance ) { 62 62 63 // Get widget settings 63 // Get widget settings. 64 64 $settings = $this->parse_settings( $instance ); 65 65 … … 86 86 $separator = apply_filters( 'bp_members_widget_separator', '|' ); 87 87 88 // Output before widget HTMl, title (and maybe content before & after it) 88 // Output before widget HTMl, title (and maybe content before & after it). 89 89 echo $args['before_widget'] 90 90 . $args['before_title'] … … 92 92 . $args['after_title']; 93 93 94 // Setup args for querying members 94 // Setup args for querying members. 95 95 $members_args = array( 96 96 'user_id' => 0, … … 165 165 * @param array $new_instance The new instance options. 166 166 * @param array $old_instance The old instance options. 167 * 168 * @return array $instance The parsed options to be saved. 167 * @return array $instance The parsed options to be saved. 169 168 */ 170 169 public function update( $new_instance, $old_instance ) { … … 184 183 * @param array $instance Widget instance settings. 185 184 * 186 * @return string185 * @return void 187 186 */ 188 187 public function form( $instance ) { 189 188 190 // Get widget settings 189 // Get widget settings. 191 190 $settings = $this->parse_settings( $instance ); 192 191 $title = strip_tags( $settings['title'] ); … … 233 232 * @since 2.3.0 234 233 * 234 * @uses bp_parse_args() To merge widget settings into defaults. 235 * 235 236 * @param array $instance Widget instance settings. 236 *237 * @uses bp_parse_args() To merge widget settings into defaults.238 *239 237 * @return array 240 238 */ … … 278 276 public function widget( $args, $instance ) { 279 277 280 // Get widget settings 278 // Get widget settings. 281 279 $settings = $this->parse_settings( $instance ); 282 280 … … 298 296 . $args['after_title']; 299 297 300 // Setup args for querying members 298 // Setup args for querying members. 301 299 $members_args = array( 302 300 'user_id' => 0, … … 338 336 * @param array $new_instance The new instance options. 339 337 * @param array $old_instance The old instance options. 340 * 341 * @return array $instance The parsed options to be saved. 338 * @return array $instance The parsed options to be saved. 342 339 */ 343 340 public function update( $new_instance, $old_instance ) { … … 353 350 * 354 351 * @param array $instance Widget instance settings. 355 * 356 * @return string 352 * @return void 357 353 */ 358 354 public function form( $instance ) { 359 355 360 // Get widget settings 356 // Get widget settings. 361 357 $settings = $this->parse_settings( $instance ); 362 358 $title = strip_tags( $settings['title'] ); … … 385 381 * @since 2.3.0 386 382 * 383 * @uses bp_parse_args() To merge widget settings into defaults. 384 * 387 385 * @param array $instance Widget instance settings. 388 *389 * @uses bp_parse_args() To merge widget settings into defaults.390 *391 386 * @return array 392 387 */ … … 428 423 public function widget( $args, $instance ) { 429 424 430 // Get widget settings 425 // Get widget settings. 431 426 $settings = $this->parse_settings( $instance ); 432 427 … … 448 443 . $args['after_title']; 449 444 450 // Setup args for querying members 445 // Setup args for querying members. 451 446 $members_args = array( 452 447 'user_id' => 0, … … 488 483 * @param array $new_instance The new instance options. 489 484 * @param array $old_instance The old instance options. 490 *491 485 * @return array $instance The parsed options to be saved. 492 486 */ … … 503 497 * 504 498 * @param array $instance Widget instance settings. 505 * 506 * @return string 499 * @return void 507 500 */ 508 501 public function form( $instance ) { 509 502 510 // Get widget settings 503 // Get widget settings. 511 504 $settings = $this->parse_settings( $instance ); 512 505 $title = strip_tags( $settings['title'] ); … … 535 528 * @since 2.3.0 536 529 * 530 * @uses bp_parse_args() To merge widget settings into defaults. 531 * 537 532 * @param array $instance Widget instance settings. 538 *539 * @uses bp_parse_args() To merge widget settings into defaults.540 *541 533 * @return array 542 534 */ … … 560 552 check_ajax_referer( 'bp_core_widget_members' ); 561 553 562 // Setup some variables to check 554 // Setup some variables to check. 563 555 $filter = ! empty( $_POST['filter'] ) ? $_POST['filter'] : 'recently-active-members'; 564 556 $max_members = ! empty( $_POST['max-members'] ) ? absint( $_POST['max-members'] ) : 5; 565 557 566 // Determine the type of members query to perform 558 // Determine the type of members query to perform. 567 559 switch ( $filter ) { 568 560 569 // Newest activated 561 // Newest activated. 570 562 case 'newest-members' : 571 563 $type = 'newest'; 572 564 break; 573 565 574 // Popular by friends 566 // Popular by friends. 575 567 case 'popular-members' : 576 568 if ( bp_is_active( 'friends' ) ) { … … 581 573 break; 582 574 583 // Default 575 // Default. 584 576 case 'recently-active-members' : 585 577 default : … … 588 580 } 589 581 590 // Setup args for querying members 582 // Setup args for querying members. 591 583 $members_args = array( 592 584 'user_id' => 0, … … 598 590 ); 599 591 600 // Query for members 592 // Query for members. 601 593 if ( bp_has_members( $members_args ) ) : ?> 602 <?php echo '0[[SPLIT]]'; // return valid result. TODO: remove this. ?>594 <?php echo '0[[SPLIT]]'; // Return valid result. TODO: remove this. ?> 603 595 <?php while ( bp_members() ) : bp_the_member(); ?> 604 596 <li class="vcard">
Note: See TracChangeset
for help on using the changeset viewer.