Merge pull request #15900 from JustinSainton/patch-4

Add search_customers() filter
This commit is contained in:
Mike Jolley 2017-07-04 10:54:50 +01:00 committed by GitHub
commit 6bc1c16d77
1 changed files with 4 additions and 4 deletions

View File

@ -374,14 +374,14 @@ class WC_Customer_Data_Store extends WC_Data_Store_WP implements WC_Customer_Dat
* @return array
*/
public function search_customers( $term, $limit = '' ) {
$query = new WP_User_Query( array(
$query = new WP_User_Query( apply_filters( 'woocommerce_customer_search_customers', array(
'search' => '*' . esc_attr( $term ) . '*',
'search_columns' => array( 'user_login', 'user_url', 'user_email', 'user_nicename', 'display_name' ),
'fields' => 'ID',
'number' => $limit,
) );
), $term, $limit, 'main_query' ) );
$query2 = new WP_User_Query( array(
$query2 = new WP_User_Query( apply_filters( 'woocommerce_customer_search_customers', array(
'fields' => 'ID',
'number' => $limit,
'meta_query' => array(
@ -397,7 +397,7 @@ class WC_Customer_Data_Store extends WC_Data_Store_WP implements WC_Customer_Dat
'compare' => 'LIKE',
),
),
) );
), $term, $limit, 'meta_query' ) );
$results = wp_parse_id_list( array_merge( $query->get_results(), $query2->get_results() ) );