API / Minn\Runtime / UserQueryRunner

UserQueryRunner final class

Minn\Runtime\UserQueryRunner · public/minn/src/Minn/Runtime/UserQueryRunner.php · 218 lines

WP_User_Query as the reference runs it (probe wp-user-query-sql): the variables filled and handed to pre_get_users; the fields (a column list, ids, the count), published authors, nicenames and logins, the meta query with the roles and capabilities joined in, the order (post counts joined in, include and list orders kept), the limit, a search over the columns its shape suggests (through user_search_columns), ids in or out, the date query, then pre_user_query; the query (users_pre_query may answer it), found_users_query, and the results shaped as the fields ask.

Constants and properties

privateCOLUMNS = array ( 0 => 'id', 1 => 'user_login', 2 => 'user_pass', 3 => 'user_nicename', 4 => 'user_email', 5 => 'user_url', 6 => 'user_registered', 7 => 'user_activation_key', 8 => 'user_status', 9 => 'display_name', )
privateSEARCHABLE = array ( 0 => 'ID', 1 => 'user_login', 2 => 'user_email', 3 => 'user_url', 4 => 'user_nicename', 5 => 'display_name', )
privateEMAIL = 'user_email'
privateURL = 'user_url'
privatereadonly object $wpdb

Promoted from the constructor.

Public

new__construct(object $wpdb)#
methodprepare(WP_User_Query $query): void#

Builds the query's pieces from its variables, as prepare_query does.

staticsearchSql(string $search, array $columns, string|false $wild): string#

A search over columns (get_search_sql): ID matched exactly, the rest by LIKE with wildcards at the leading or trailing end, or both.

$columnslist<string>
methodquery(WP_User_Query $query): void#

Runs the query: users_pre_query may answer it; the count follows; the results take the fields' shape.

Internals 6

Private and protected methods: how the class does its work. Not a contract; they change whenever the code is tidied.

privatefields(array $qv): string#

The SELECT's fields: named columns, ids, and the count's own. @param array<string, mixed> $qv

$qvarray<string, mixed>
privatepublished(array $qv, int $blog): string#

Authors with published posts (of public types, or the ones named). @param array<string, mixed> $qv

$qvarray<string, mixed>
privatenames(array $qv): string#

One nicename or login, or lists of them, in or out. @param array<string, mixed> $qv

$qvarray<string, mixed>
privatemeta(WP_User_Query $query, array $qv, int $blog): void#

The meta query with roles and capabilities, joined and written in. @param array<string, mixed> $qv

$qvarray<string, mixed>
privateorder(WP_User_Query $query, array $qv): string#

ORDER BY from a key, a list, or a map of keys to directions; user_login when none is usable. @param array<string, mixed> $qv

$qvarray<string, mixed>
privatesearch(WP_User_Query $query, string $search, array $given): string#

The search: wildcards at either end, the columns given (those the reference searches) or those its shape suggests, through user_search_columns; ID matched exactly, the rest by LIKE.

$givenlist<string>