[wp-trac] [WordPress Trac] #19623: Use Comment API in comments_template, rather than hardcoded SQL

WordPress Trac noreply at wordpress.org
Fri Oct 17 03:46:23 UTC 2014


#19623: Use Comment API in comments_template, rather than hardcoded SQL
-------------------------------------------------+-------------------------
 Reporter:  simonwheatley                        |       Owner:
     Type:  enhancement                          |  boonebgorges
 Priority:  normal                               |      Status:  accepted
Component:  Comments                             |   Milestone:  4.1
 Severity:  major                                |     Version:  3.3
 Keywords:  has-patch needs-testing 2nd-opinion  |  Resolution:
                                                 |     Focuses:
-------------------------------------------------+-------------------------

Comment (by boonebgorges):

 After some more thinking, [attachment:19623.patch] is an update that I
 think makes more sense from an API point of view than the other options on
 the table.

 Instead of separate params for `unapproved_author`,
 `unapproved_author_email`, and `unapproved_user_id`, a single param:
 `include_unapproved`. Accepts an array (or comma-separated string) of user
 IDs or email addresses. A couple things I like about this ("like" being a
 relative term here):

 * The naming is better. 'include_unapproved' carries with it the
 implication that these unapproved comments will be included *regardless
 of* the 'status' parameter.
 * No need to pass `unapproved_author`. Email address is enough to
 differentiate.
 * Accepts multiple values. This makes it seem slightly less like a kludge
 built for the specific purposes of `comments_template()`, and more like a
 legitimate API feature.

 I feel this is a significant enough improvement to the previous
 suggestions (and it's a huge improvement over the current situation of
 making direct SQL queries) that I would feel OK with it going into 4.1
 like this, even if we ended up doing something more robust down the line.
 I'll wait a few days before going ahead with it to see if any brilliant
 commentary coalesces out of the ether ;)

--
Ticket URL: <https://core.trac.wordpress.org/ticket/19623#comment:18>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list