We need to check for ID in array to exclude user ID as search_columns are of different

This commit is contained in:
Shiva Poudel 2016-02-17 00:25:06 +05:45
parent a88caf5b72
commit 5fb5a7ded2
1 changed files with 3 additions and 2 deletions

View File

@ -1983,7 +1983,6 @@ class WC_AJAX {
'fields' => 'all',
'orderby' => 'display_name',
'search' => '*' . $term . '*',
'exclude' => $exclude,
'search_columns' => array( 'ID', 'user_login', 'user_email', 'user_nicename' )
) ) );
@ -1993,7 +1992,9 @@ class WC_AJAX {
if ( ! empty( $customers ) ) {
foreach ( $customers as $customer ) {
$found_customers[ $customer->ID ] = $customer->display_name . ' (#' . $customer->ID . ' – ' . sanitize_email( $customer->user_email ) . ')';
if ( ! in_array( $customer->ID, $exclude ) ) {
$found_customers[ $customer->ID ] = $customer->display_name . ' (#' . $customer->ID . ' – ' . sanitize_email( $customer->user_email ) . ')';
}
}
}