[wp-trac] [WordPress Trac] #29612: Query for multiple comment statuses
WordPress Trac
noreply at wordpress.org
Tue Oct 21 14:25:50 UTC 2014
#29612: Query for multiple comment statuses
-------------------------+---------------------------
Reporter: ebinnion | Owner: boonebgorges
Type: enhancement | Status: accepted
Priority: normal | Milestone: 4.1
Component: Comments | Version: 4.0
Severity: normal | Resolution:
Keywords: has-patch | Focuses:
-------------------------+---------------------------
Changes (by boonebgorges):
* owner: => boonebgorges
* status: new => accepted
* milestone: Awaiting Review => 4.1
Comment:
In [29980], I added some more systematic unit tests for the existing
functionality.
[attachment:29612.patch] adds support for multiple comment statuses:
* Accepts an array or a comma-separated string
* A value of 'any' will cause the 'comment_approved' clause to be skipped,
returning comments regardless of 'comment_approved' value. 'any' will
override any status it's included with (eg `array( 'any', 'approve' )`
* The 'any' functionality means that sometimes the 'approved' WHERE clause
will be empty - and, in certain cases, the WP_Comment_Query SQL query will
not contain a WHERE clause at all. This means that the current way of
concatenating the WHERE clause won't work. I've changed it so that it
builds an array of subclauses, which get assembled just before the final
query string is built. Note that in the case of date_query, meta_query,
and get_search_sql(), this meant stripping the leading ' AND ' from the
SQL chunks. A bit ugly, but necessary for backward compatibility.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/29612#comment:9>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list