[wp-trac] [WordPress Trac] #22212: WP_User_Query( array('role' => $role) ) should accept array or not return anything if array
WordPress Trac
noreply at wordpress.org
Wed Oct 7 09:49:16 UTC 2015
#22212: WP_User_Query( array('role' => $role) ) should accept array or not return
anything if array
--------------------------------------+---------------------------
Reporter: thomask | Owner: boonebgorges
Type: enhancement | Status: reopened
Priority: normal | Milestone: 4.4
Component: Users | Version:
Severity: normal | Resolution:
Keywords: has-patch has-unit-tests | Focuses:
--------------------------------------+---------------------------
Comment (by swissspidy):
I just tested the new patch and it looks good so far. What's it with these
sanity checks though?
{{{
// Sanity check: this clause may already have been added to the
meta_query.
if ( empty( $this->meta_query->clauses ) || ! in_array( $roles_clauses,
$this->meta_query_clauses, true ) ) {
$role_queries[] = $roles_clauses;
}
}}}
1. This should probably be `if ( empty( $this->meta_query->queries ) || !
in_array( $roles_clauses, $this->meta_query->queries, true ) ) {`
(`clauses` is protected)
2. Either we add this check to all role clauses (see my patch) or remove
it (what breaks?).
3. What about a test for this sanity check?
--
Ticket URL: <https://core.trac.wordpress.org/ticket/22212#comment:58>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list