Changeset 8087 for trunk/bp-core/bp-core-classes.php
- Timestamp:
- 03/09/2014 01:58:11 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-core/bp-core-classes.php
r8054 r8087 362 362 /** Search Terms ******************************************************/ 363 363 364 // 'search_terms' searches the xprofile fields 365 // To avoid global joins, do a separate query 366 // @todo remove need for bp_is_active() check 367 if ( false !== $search_terms && bp_is_active( 'xprofile' ) ) { 364 // 'search_terms' searches user_login and user_nicename 365 // xprofile field matches happen in bp_xprofile_bp_user_query_search() 366 if ( false !== $search_terms ) { 368 367 $search_terms_clean = esc_sql( esc_sql( $search_terms ) ); 369 $search_terms_clean = like_escape( $search_terms_clean ); 370 $found_user_ids_query = "SELECT user_id FROM {$bp->profile->table_name_data} WHERE value LIKE '%" . $search_terms_clean . "%'"; 371 $found_user_ids = $wpdb->get_col( $found_user_ids_query ); 372 373 if ( ! empty( $found_user_ids ) ) { 374 $sql['where'][] = "u.{$this->uid_name} IN (" . implode( ',', wp_parse_id_list( $found_user_ids ) ) . ")"; 375 } else { 376 $sql['where'][] = $this->no_results['where']; 377 } 368 $sql['where']['search'] = "u.{$this->uid_name} IN ( SELECT ID FROM {$wpdb->users} WHERE ( user_login LIKE '%{$search_terms_clean}%' OR user_nicename LIKE '%{$search_terms_clean}%' ) )"; 378 369 } 379 370 … … 400 391 $sql['limit'] = ''; 401 392 } 393 394 // Allow custom filters 395 $sql = apply_filters_ref_array( 'bp_user_query_uid_clauses', array( $sql, &$this ) ); 402 396 403 397 // Assemble the query chunks
Note: See TracChangeset
for help on using the changeset viewer.