Set a variable for like-escaped string before looping in WP_User_Query::get_search_sql().

Props miqrogroove.
Fixes #10041.


git-svn-id: https://develop.svn.wordpress.org/trunk@28722 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Scott Taylor 2014-06-10 02:44:35 +00:00
parent 013f3f14e3
commit fe2ca3965e

View File

@ -802,11 +802,14 @@ class WP_User_Query {
$searches = array();
$leading_wild = ( 'leading' == $wild || 'both' == $wild ) ? '%' : '';
$trailing_wild = ( 'trailing' == $wild || 'both' == $wild ) ? '%' : '';
$like = $leading_wild . $wpdb->esc_like( $string ) . $trailing_wild;
foreach ( $cols as $col ) {
if ( 'ID' == $col )
if ( 'ID' == $col ) {
$searches[] = $wpdb->prepare( "$col = %s", $string );
else
$searches[] = $wpdb->prepare( "$col LIKE %s", $leading_wild . $wpdb->esc_like( $string ) . $trailing_wild );
} else {
$searches[] = $wpdb->prepare( "$col LIKE %s", $like );
}
}
return ' AND (' . implode(' OR ', $searches) . ')';