Changeset 8753
- Timestamp:
- 08/03/2014 08:51:44 PM (10 years ago)
- Location:
- trunk/src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-core/bp-core-classes.php
r8677 r8753 369 369 // xprofile field matches happen in bp_xprofile_bp_user_query_search() 370 370 if ( false !== $search_terms ) { 371 $search_terms _like= bp_esc_like( $search_terms );371 $search_terms = bp_esc_like( $search_terms ); 372 372 373 373 if ( $search_wildcard === 'left' ) { 374 $search_terms_like = '%' . $search_terms_like; 374 $search_terms_nospace = '%' . $search_terms; 375 $search_terms_space = '%' . $search_terms . ' %'; 375 376 } elseif ( $search_wildcard === 'right' ) { 376 $search_terms_like = $search_terms_like . '%'; 377 $search_terms_nospace = $search_terms . '%'; 378 $search_terms_space = '% ' . $search_terms . '%'; 377 379 } else { 378 $search_terms_like = '%' . $search_terms_like . '%'; 379 } 380 381 $sql['where']['search'] = $wpdb->prepare( "u.{$this->uid_name} IN ( SELECT ID FROM {$wpdb->users} WHERE ( user_login LIKE %s OR user_nicename LIKE %s ) )", $search_terms_like, $search_terms_like ); 380 $search_terms_nospace = '%' . $search_terms . '%'; 381 $search_terms_space = '%' . $search_terms . '%'; 382 } 383 384 $sql['where']['search'] = $wpdb->prepare( 385 "u.{$this->uid_name} IN ( SELECT ID FROM {$wpdb->users} WHERE ( user_login LIKE %s OR user_login LIKE %s OR user_nicename LIKE %s OR user_nicename LIKE %s ) )", 386 $search_terms_nospace, 387 $search_terms_space, 388 $search_terms_nospace, 389 $search_terms_space 390 ); 382 391 } 383 392 … … 2567 2576 */ 2568 2577 protected $default_args = array( 2569 'limit' => 1 6,2578 'limit' => 10, 2570 2579 'only_friends' => false, 2571 2580 'term' => '', … … 2607 2616 'per_page' => $this->args['limit'], 2608 2617 'search_terms' => $this->args['term'], 2618 'search_wildcard' => is_rtl() ? 'left' : 'right', 2609 2619 ); 2610 2620 -
trunk/src/bp-groups/bp-groups-classes.php
r8669 r8753 4388 4388 'per_page' => $this->args['limit'], 4389 4389 'search_terms' => $this->args['term'], 4390 'search_wildcard' => 'right', 4390 4391 ); 4391 4392 -
trunk/src/bp-xprofile/bp-xprofile-functions.php
r8689 r8753 591 591 $bp = buddypress(); 592 592 593 $search_terms_clean = esc_sql( esc_sql( $query->query_vars['search_terms'] ));593 $search_terms_clean = bp_esc_like( $query->query_vars['search_terms'] ); 594 594 595 595 if ( $query->query_vars['search_wildcard'] === 'left' ) { 596 $search_terms_clean = '%' . $search_terms_clean; 596 $search_terms_nospace = '%' . $search_terms_clean; 597 $search_terms_space = '%' . $search_terms_clean . ' %'; 597 598 } elseif ( $query->query_vars['search_wildcard'] === 'right' ) { 598 $search_terms_clean = $search_terms_clean . '%'; 599 $search_terms_nospace = $search_terms_clean . '%'; 600 $search_terms_space = '% ' . $search_terms_clean . '%'; 599 601 } else { 600 $search_terms_clean = '%' . $search_terms_clean . '%'; 602 $search_terms_nospace = '%' . $search_terms_clean . '%'; 603 $search_terms_space = '%' . $search_terms_clean . '%'; 601 604 } 602 605 603 606 // Combine the core search (against wp_users) into a single OR clause 604 607 // with the xprofile_data search 608 $search_xprofile = $wpdb->prepare( 609 "u.{$query->uid_name} IN ( SELECT user_id FROM {$bp->profile->table_name_data} WHERE value LIKE %s OR value LIKE %s )", 610 $search_terms_nospace, 611 $search_terms_space 612 ); 613 605 614 $search_core = $sql['where']['search']; 606 $search_xprofile = "u.{$query->uid_name} IN ( SELECT user_id FROM {$bp->profile->table_name_data} WHERE value LIKE '{$search_terms_clean}' )";607 615 $search_combined = "( {$search_xprofile} OR {$search_core} )"; 608 609 616 $sql['where']['search'] = $search_combined; 610 617
Note: See TracChangeset
for help on using the changeset viewer.