diff --git a/src/bp-core/classes/class-bp-user-query.php b/src/bp-core/classes/class-bp-user-query.php
index 34ecfbd..dee67a6 100644
a
|
b
|
class BP_User_Query { |
413 | 413 | $search_terms_space = '%' . $search_terms . '%'; |
414 | 414 | } |
415 | 415 | |
416 | | $sql['where']['search'] = $wpdb->prepare( |
417 | | "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 ) )", |
| 416 | $sql['select'] .= $wpdb->prepare( |
| 417 | " JOIN {$wpdb->users} r ON r.ID = u.{$this->uid_name} AND ( r.user_login LIKE %s OR r.user_login LIKE %s OR r.user_nicename LIKE %s OR r.user_nicename LIKE %s ) )", |
418 | 418 | $search_terms_nospace, |
419 | 419 | $search_terms_space, |
420 | 420 | $search_terms_nospace, |
diff --git a/src/bp-xprofile/bp-xprofile-functions.php b/src/bp-xprofile/bp-xprofile-functions.php
index fb1bf33..227680d 100644
a
|
b
|
function xprofile_avatar_upload_dir( $directory = 'avatars', $user_id = 0 ) { |
760 | 760 | function bp_xprofile_bp_user_query_search( $sql, BP_User_Query $query ) { |
761 | 761 | global $wpdb; |
762 | 762 | |
763 | | if ( empty( $query->query_vars['search_terms'] ) || empty( $sql['where']['search'] ) ) { |
| 763 | if ( empty( $query->query_vars['search_terms'] ) ) { |
764 | 764 | return $sql; |
765 | 765 | } |
766 | 766 | |
… |
… |
function bp_xprofile_bp_user_query_search( $sql, BP_User_Query $query ) { |
781 | 781 | |
782 | 782 | // Combine the core search (against wp_users) into a single OR clause |
783 | 783 | // with the xprofile_data search. |
784 | | $search_xprofile = $wpdb->prepare( |
785 | | "u.{$query->uid_name} IN ( SELECT user_id FROM {$bp->profile->table_name_data} WHERE value LIKE %s OR value LIKE %s )", |
| 784 | $sql['select'] .= $wpdb->prepare( |
| 785 | " JOIN {$bp->profile->table_name_data} p ON p.user_id = u.{$query->uid_name} AND ( p.value LIKE %s OR p.value LIKE %s )", |
786 | 786 | $search_terms_nospace, |
787 | 787 | $search_terms_space |
788 | 788 | ); |
789 | 789 | |
790 | | $search_core = $sql['where']['search']; |
791 | | $search_combined = "( {$search_xprofile} OR {$search_core} )"; |
792 | | $sql['where']['search'] = $search_combined; |
793 | | |
794 | 790 | return $sql; |
795 | 791 | } |
796 | 792 | add_action( 'bp_user_query_uid_clauses', 'bp_xprofile_bp_user_query_search', 10, 2 ); |