Changeset 9586 for trunk/src/bp-core/classes/class-bp-user-query.php
- Timestamp:
- 03/03/2015 04:16:23 AM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-core/classes/class-bp-user-query.php
r9486 r9586 174 174 ) ); 175 175 176 // Plugins can use this filter to modify query args 177 // before the query is constructed 176 /** 177 * Fires before the construction of the BP_User_Query query. 178 * 179 * @since BuddyPress (1.7.0) 180 * 181 * @param BP_User_Query $this Current instance of the BP_User_Query. Passed by reference. 182 */ 178 183 do_action_ref_array( 'bp_pre_user_query_construct', array( &$this ) ); 179 184 … … 262 267 $sql['select'] = "SELECT u.{$this->uid_name} as id FROM {$this->uid_table} u"; 263 268 $sql['where'][] = $wpdb->prepare( "u.component = %s AND u.type = 'last_activity'", buddypress()->members->id ); 269 270 /** 271 * Filters the threshold for activity timestamp minutes since to indicate online status. 272 * 273 * @since BuddyPress (1.8.0) 274 * 275 * @param int $value Amount of minutes for threshold. Default 15. 276 */ 264 277 $sql['where'][] = $wpdb->prepare( "u.date_recorded >= DATE_SUB( UTC_TIMESTAMP(), INTERVAL %d MINUTE )", apply_filters( 'bp_user_query_online_interval', 15 ) ); 265 278 $sql['orderby'] = "ORDER BY u.date_recorded"; … … 472 485 } 473 486 474 // Allow custom filters 487 /** 488 * Filters the clauses for the user query. 489 * 490 * @since BuddyPress (2.0.0) 491 * 492 * @param array $sql Array of SQL clauses to be used in the query. 493 * @param BP_User_Query $this Current BP_User_Query instance. 494 */ 475 495 $sql = apply_filters_ref_array( 'bp_user_query_uid_clauses', array( $sql, &$this ) ); 476 496 … … 482 502 $this->uid_clauses['limit'] = $sql['limit']; 483 503 504 /** 505 * Fires before the BP_User_Query query is made. 506 * 507 * @since BuddyPress (1.7.0) 508 * 509 * @param BP_User_Query $this Current BP_User_Query instance. Passed by reference. 510 */ 484 511 do_action_ref_array( 'bp_pre_user_query', array( &$this ) ); 485 512 } … … 508 535 // Get the total user count 509 536 if ( 'sql_calc_found_rows' == $this->query_vars['count_total'] ) { 537 538 /** 539 * Filters the found user SQL statements before query. 540 * 541 * If "sql_calc_found_rows" is the provided count_total query var 542 * then the value will be "SELECT FOUND_ROWS()". Otherwise it will 543 * use a "SELECT COUNT()" query statement. 544 * 545 * @since BuddyPress (1.7.0) 546 * 547 * @param string $value SQL statement to select FOUND_ROWS(). 548 * @param BP_User_Query $this Current BP_User_Query instance. 549 */ 510 550 $this->total_users = $wpdb->get_var( apply_filters( 'bp_found_user_query', "SELECT FOUND_ROWS()", $this ) ); 511 551 } elseif ( 'count_query' == $this->query_vars['count_total'] ) { 512 552 $count_select = preg_replace( '/^SELECT.*?FROM (\S+) u/', "SELECT COUNT(u.{$this->uid_name}) FROM $1 u", $this->uid_clauses['select'] ); 553 554 /** This filter is documented in bp-core/classes/class-bp-user-query.php */ 513 555 $this->total_users = $wpdb->get_var( apply_filters( 'bp_found_user_query', "{$count_select} {$this->uid_clauses['where']}", $this ) ); 514 556 } … … 528 570 } 529 571 572 /** 573 * Filters the WP User Query arguments before passing into the class. 574 * 575 * @since BuddyPress (1.7.0) 576 * 577 * @param array $value Array of arguments for the user query. 578 * @param BP_User_Query $this Current BP_User_Query instance. 579 */ 530 580 $wp_user_query = new WP_User_Query( apply_filters( 'bp_wp_user_query_args', array( 531 581 … … 628 678 629 679 /** 630 * Use this action to independently populate your owncustom extras.680 * Allows users to independently populate custom extras. 631 681 * 632 682 * Note that anything you add here should query using $user_ids_sql, to … … 634 684 * 635 685 * Two BuddyPress components currently do this: 636 * - XProfile: To override display names 637 * - Friends: To set whether or not a user is the current users friend 686 * - XProfile: To override display names. 687 * - Friends: To set whether or not a user is the current users friend. 638 688 * 639 689 * @see bp_xprofile_filter_user_query_populate_extras() 640 690 * @see bp_friends_filter_user_query_populate_extras() 691 * 692 * @since BuddyPress (1.7.0) 693 * 694 * @param BP_User_Query $this Current BP_User_Query instance. 695 * @param string $user_ids_sql Comma-separated string of user IDs. 641 696 */ 642 697 do_action_ref_array( 'bp_user_query_populate_extras', array( $this, $user_ids_sql ) );
Note: See TracChangeset
for help on using the changeset viewer.