-
Notifications
You must be signed in to change notification settings - Fork 466
Description
I would like to query users by email and nickname.
query will be like this:
Where
email like '%test%' OR
nickname like '%test%'
To Test
query NewQuery {
users(where: {search: "test", searchColumns: [NICENAME, EMAIL]}) {
edges {
node {
firstName
lastName
name
nickname
email
}
}
}
}
In get_query of UserConnectionResolver, $this->query_args before running query is below:
{ ["count_total"]=> bool(false) ["graphql_args"]=> array(1) { ["where"]=> array(2) { ["search"]=> string(4) "test" ["searchColumns"]=> array(1) { [0]=> string(8) "nicename" } } } ["graphql_cursor_offset"]=> int(0) ["graphql_cursor_compare"]=> string(1) "<" ["graphql_after_cursor"]=> NULL ["graphql_before_cursor"]=> NULL ["number"]=> int(11) ["search"]=> string(6) "*test*" ["search_columns"]=> array(1) { [0]=> string(8) "nicename" } ["fields"]=> string(2) "ID" ["has_published_posts"]=> bool(true) ["orderby"]=> string(10) "user_login" ["order"]=> string(3) "ASC" }
the query string after running query:
SELECT wp_users.ID FROM wp_users WHERE 1=1 AND wp_users.ID IN ( SELECT DISTINCT wp_posts.post_author FROM wp_posts WHERE wp_posts.post_status = 'publish' AND wp_posts.post_type IN ( 'post', 'page', 'attachment' ) ) AND (user_login LIKE '%test%' OR user_url LIKE '%test%' OR user_email LIKE '%test%' OR user_nicename LIKE '%test%' OR display_name LIKE '%test%') ORDER BY user_login ASC, wp_users.ID DESC LIMIT 0, 11
I would like to get the query string like this.
SELECT wp_users.ID FROM wp_users WHERE 1=1 AND wp_users.ID IN ( SELECT DISTINCT wp_posts.post_author FROM wp_posts WHERE wp_posts.post_status = 'publish' AND wp_posts.post_type IN ( 'post', 'page', 'attachment' ) ) AND (user_email LIKE '%test%' OR user_nicename LIKE '%test%') ORDER BY user_login ASC, wp_users.ID DESC LIMIT 0, 11
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
