Commit Graph

344 Commits

Author SHA1 Message Date
Boone Gorges
b3e11db20b Respect comment_date and comment_date_gmt params in wp_new_comment().
Props solarissmoke, oso96_2000.
Fixes #14279.
Built from https://develop.svn.wordpress.org/trunk@31615


git-svn-id: http://core.svn.wordpress.org/trunk@31596 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-03-05 03:00:26 +00:00
Scott Taylor
94bd0f93b8 wp_insert_comment() should be checking and setting $compacted, not the non-existent $post_data.
See [31263], #21212.

Built from https://develop.svn.wordpress.org/trunk@31553


git-svn-id: http://core.svn.wordpress.org/trunk@31534 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-02-26 05:38:24 +00:00
Boone Gorges
a224ff7d9b Improve 'orderby' syntax for WP_Comment_Query.
Since [29027], `WP_Query` has supported an array of values for the `$orderby`
parameter, with field names as array keys and ASC/DESC as the array values.
This changeset introduces the same syntax to `WP_Comment_Query`.

We leverage the new support for multiple ORDER BY clauses to fix a bug that
causes comments to be queried in an indeterminate order when sorting by the
default `comment_date_gmt` and comments share the same value for
`comment_date_gmt`. By always including a `comment_ID` subclause at the end of
the ORDER BY statement, we ensure that comments always have a unique fallback
for sorting.

This changeset also includes improvements paralleling those introduced to
`WP_Query` in [31312] and [31340], which allow `$orderby` to accept array keys
from specific `$meta_query` clauses. This change lets devs sort by multiple
clauses of an associated meta query. See #31045.

Fixes #30478. See #31265.
Built from https://develop.svn.wordpress.org/trunk@31467


git-svn-id: http://core.svn.wordpress.org/trunk@31448 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-02-16 14:10:27 +00:00
Gary Pendergast
dc0f9e0079 Comments: When a comment fails to insert, remove invalid characters from the email and URL fields, too.
See [31263], #21212


Built from https://develop.svn.wordpress.org/trunk@31264


git-svn-id: http://core.svn.wordpress.org/trunk@31245 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-01-21 23:18:22 +00:00
Gary Pendergast
8196266d26 Comments: When a comment fails to insert, remove any invalid characters and try again.
See #21212


Built from https://develop.svn.wordpress.org/trunk@31263


git-svn-id: http://core.svn.wordpress.org/trunk@31244 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-01-21 23:04:23 +00:00
Gary Pendergast
b74f13511a Allow comment_post_ID to be passed to wp_update_comment(), so that a comment can be moved to a different post.
Props tyxla, rachelbaker

Fixes #30946


Built from https://develop.svn.wordpress.org/trunk@31195


git-svn-id: http://core.svn.wordpress.org/trunk@31176 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-01-16 02:39:23 +00:00
Sergey Biryukov
dcaa26c1de Add 'user_id' to the list of fields wp_update_comment() can update.
props jphase.
fixes #30307.
Built from https://develop.svn.wordpress.org/trunk@31172


git-svn-id: http://core.svn.wordpress.org/trunk@31153 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-01-13 06:48:22 +00:00
Sergey Biryukov
47b47c4980 Add 'comment_type' to the list of fields wp_update_comment() can update.
props desaiuditd.
fixes #30627.
Built from https://develop.svn.wordpress.org/trunk@31171


git-svn-id: http://core.svn.wordpress.org/trunk@31152 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-01-13 06:42:21 +00:00
Scott Taylor
61e12e00c1 In WP_Comment_Query, only allow __call() to run against ->get_search_sql().
See #30891.

Built from https://develop.svn.wordpress.org/trunk@31150


git-svn-id: http://core.svn.wordpress.org/trunk@31131 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-01-11 22:33:24 +00:00
Scott Taylor
60b0cd7943 The keyword elseif should be used instead of else if so that all control keywords look like single words.
This was a mess, is now standardized across the codebase, except for a few 3rd-party libs. 

See #30799.

Built from https://develop.svn.wordpress.org/trunk@31090


git-svn-id: http://core.svn.wordpress.org/trunk@31071 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-01-08 07:05:25 +00:00
Boone Gorges
f1a4fd6e85 Support array values for post-related parameters in WP_Comment_Query.
Props nprasath002, c3mdigital, ianmjones.
Fixes #20006.
Built from https://develop.svn.wordpress.org/trunk@31015


git-svn-id: http://core.svn.wordpress.org/trunk@30996 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-12-31 19:38:22 +00:00
Scott Taylor
e619abda6e Improve various @param docs for src/wp-includes/*.
See #30224.

Built from https://develop.svn.wordpress.org/trunk@30681


git-svn-id: http://core.svn.wordpress.org/trunk@30671 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-12-01 01:34:24 +00:00
Drew Jaynes
bffe95d34c Docs Formatting: Backtick-escape inline code for all remaining dynamic hook docs in wp-includes/*.
Affects DocBlocks for the following hooks:
* `auth_post_meta_{$meta_key}`
* `term_links-$taxonomy`
* `customize_render_control_ . $this->id`
* `customize_render_panel_{$this->id}`
* `customize_render_section_{$this->id}`
* `customize_preview_{$this->id}`
* `customize_save_ . $this->id_data[ 'base' ]`
* `customize_update_ . $this->type`
* `customize_value_ . $this->id_data[ 'base' ]`
* `customize_sanitize_js_{$this->id}`
* `comment_form_field_{$name}`
* `comment_{$old_status}_to_{$new_status}`
* `comment_{$new_status}_{$comment->comment_type}`
* `extra_{$context}_headers`
* `get_template_part_{$slug}`
* `get_the_generator_{$type}`
* `get_{$adjacent}_post_join`
* `get_{$adjacent}_post_where`
* `get_{$adjacent}_post_sort`
* `{$adjacent}_post_rel_link`
* `{$adjacent}_post_link`
* `{$adjacent}_image_link`
* `blog_option_{$option}`
* `$permastructname . _rewrite_rules`
* `{$type}_template`
* `theme_mod_{$name}`
* `pre_set_theme_mod_$name`
* `current_theme_supports-{$feature}`
* `get_user_option_{$option}`
* `edit_user_{$field}`
* `pre_user_{$field}`
* `user_{$field}`

See #30552.

Built from https://develop.svn.wordpress.org/trunk@30656


git-svn-id: http://core.svn.wordpress.org/trunk@30646 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-11-30 12:10:23 +00:00
Dominik Schilling
7e0c893415 Comments: Use proper HTTP response codes for validation errors.
props miqrogroove, solarissmoke, mackensen.
fixes #11286.
Built from https://develop.svn.wordpress.org/trunk@30579


git-svn-id: http://core.svn.wordpress.org/trunk@30569 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-11-26 20:17:24 +00:00
Boone Gorges
e2339bdb1b Return an empty array from get_approved_comments() when $post_id is empty.
This behavior was broken when moving the internals to `WP_Comment_Query` in
[30098]. As a result, `get_approved_comments( 0 )` was fetching *all* approved
comments, causing performance issues.

Props dd32.
Fixes #30412.
Built from https://develop.svn.wordpress.org/trunk@30402


git-svn-id: http://core.svn.wordpress.org/trunk@30397 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-11-20 01:52:23 +00:00
Drew Jaynes
e7b465046a Cross-reference WP_Comment_Query::query() as the location for finding information on default arguments for WP_Comment_Query.
Also updates the return types on `get_comments()` and `get_approved_comments()`, as an integer can also be returned if the `$count` argument is true.

Fixes #30111.

Built from https://develop.svn.wordpress.org/trunk@30281


git-svn-id: http://core.svn.wordpress.org/trunk@30281 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-11-08 20:35:22 +00:00
Drew Jaynes
35e509b0c8 Document default arguments for WP_Comment_Query class as a hash notation.
Props boonebgorges, DrewAPicture.
See #30111.

Built from https://develop.svn.wordpress.org/trunk@30280


git-svn-id: http://core.svn.wordpress.org/trunk@30280 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-11-08 20:19:23 +00:00
Scott Taylor
7d7a8aa0eb Correct all @return unknown instances.
See #30224.

Built from https://develop.svn.wordpress.org/trunk@30202


git-svn-id: http://core.svn.wordpress.org/trunk@30202 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-11-03 06:17:22 +00:00
Scott Taylor
a23c230c01 In WP_Comment_Query, declare $query_vars and $comments as properties.
See #30224.

Built from https://develop.svn.wordpress.org/trunk@30182


git-svn-id: http://core.svn.wordpress.org/trunk@30182 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-11-03 03:08:22 +00:00
Drew Jaynes
66c47f29bb Correct references of @uses $wpdb in core documentation to use @global.
See #30191, [30105].
Fixes #30217.

Built from https://develop.svn.wordpress.org/trunk@30122


git-svn-id: http://core.svn.wordpress.org/trunk@30122 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-10-31 17:56:22 +00:00
Drew Jaynes
8fcc2b3dc8 Update the changelog for WP_Comment_Query::query() to reflect two more new arguments added in [30096].
[30096] introduced the `type__in` and `type__not_in` arguments. See #30111 for documentation on those new arguments.

Fixes #12668.

Built from https://develop.svn.wordpress.org/trunk@30110


git-svn-id: http://core.svn.wordpress.org/trunk@30110 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-10-30 03:06:24 +00:00
Drew Jaynes
54020268f7 Update the changelog for get_approved_comments() to reflect that the function was refactored to leverage WP_Comment_Query in [30098].
Also updates the `$args` parameter description with a reference to see `WP_Comment_Query` for argument information.

See #12668.

Built from https://develop.svn.wordpress.org/trunk@30109


git-svn-id: http://core.svn.wordpress.org/trunk@30109 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-10-30 02:51:23 +00:00
Drew Jaynes
f8657d5890 Remove redundant and erroneous @uses tag from most core inline documentation.
Per our inline documentation standards, no further use of the `@uses` tag is recommended as used and used-by relationships can be derived through other means. This removes most uses of the tag in core documentation, with remaining tags to be converted to `@global` or `@see` as they apply.

Fixes #30191.

Built from https://develop.svn.wordpress.org/trunk@30105


git-svn-id: http://core.svn.wordpress.org/trunk@30105 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-10-30 01:05:24 +00:00
Boone Gorges
3be72a13de Use WP_Comment_Query to query comments in get_approved_comments().
Props dancameron.
See #12668.
Built from https://develop.svn.wordpress.org/trunk@30098


git-svn-id: http://core.svn.wordpress.org/trunk@30098 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-10-29 21:58:23 +00:00
Boone Gorges
56f55ea507 Better flexibility for 'type' in WP_Comment_Query.
* Add support for an array of values in 'type'.
* Introduce `type__in` parameter. This duplicates 'type' but is added for better consistency with other query classes.
* Introduce `type__not_in`.

Among other things, these changes will make it easier for plugin authors to
manage the appearance of custom comment types in various WP interfaces.

Props dancameron, mordauk.
See #12668.
Built from https://develop.svn.wordpress.org/trunk@30096


git-svn-id: http://core.svn.wordpress.org/trunk@30096 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-10-29 21:50:22 +00:00
Boone Gorges
beaa3f6928 Support an empty string passed as a status in WP_Comment_Query.
The changes in [30084] broke backward compatibility with interfaces that
manually passed an empty string for the value of 'status', such as on
wp-admin/edit-comments.php.

Fixes #29612.
Built from https://develop.svn.wordpress.org/trunk@30093


git-svn-id: http://core.svn.wordpress.org/trunk@30093 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-10-29 19:51:23 +00:00
Boone Gorges
3b90929c3e Support multiple 'status' values in WP_Comment_Query.
This change required turning the SQL concatenation into the generation of an
array, for greater flexibility.

Props karpstrucking, ebinnion.
Fixes #29612.
Built from https://develop.svn.wordpress.org/trunk@30084


git-svn-id: http://core.svn.wordpress.org/trunk@30084 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-10-29 02:22:23 +00:00
Boone Gorges
3179629853 Fix 'count' in WP_Comment_Query when using 'meta_query'.
Props heshiming, desaiuditd.
Fixes #23369.
Built from https://develop.svn.wordpress.org/trunk@30026


git-svn-id: http://core.svn.wordpress.org/trunk@30026 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-10-26 16:46:19 +00:00
Boone Gorges
40ec420689 Allow ORDER BY in WP_Comment_Query::query() to be disabled.
Disable ORDER BY by passing boolean false, an empty array, or the string
'none' to the 'orderby parameter. This mirrors the behavior of `WP_Query`.

Props psycleuk.
Fixes #29902.
Built from https://develop.svn.wordpress.org/trunk@30004


git-svn-id: http://core.svn.wordpress.org/trunk@30004 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-10-24 02:51:19 +00:00
Boone Gorges
f780d0d09b Add unit tests for WP_Comment_Query 'orderby' param.
For better testability, the SQL string generated in `WP_Comment_Query::get_posts()`
is now stored as a 'request' property on the object.

See #29902.
Built from https://develop.svn.wordpress.org/trunk@30003


git-svn-id: http://core.svn.wordpress.org/trunk@30003 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-10-24 02:34:18 +00:00
Boone Gorges
304802d70d Use the comment API rather than direct SQL queries in comments_template().
`comments_template()` is used by most themes to display a post's comments. It
shows all comments that have been approved, and also shows all pending comments
by the current visitor (as determined by the comment cookies). However, the
comments API previously had no way of querying for "all comments that are
either approved, or are unapproved but written by foo@example.com". The
workaround was a direct SQL query: uncached, not subject to the same filters as
other comment queries, and just generally icky.

The new `include_unapproved` parameter for `WP_Comment_Query` accepts an array
of user IDs or email addresses. Pending comments associated with users in this
array will be included in query results, regardless of the value of the 'status'
parameter. In `comments_template()`, we leap from direct SQL queries to
`get_comments()` plus `include_unapproved', striving to put right what once
went wrong.

Props boonebgorges, simonwheatley, hardy101, jesin.
Fixes #19623.
Built from https://develop.svn.wordpress.org/trunk@29965


git-svn-id: http://core.svn.wordpress.org/trunk@29712 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-10-19 19:39:20 +00:00
Boone Gorges
6c6a285091 Comment/post author in/not_in for WP_Comment_Query.
Props nofearinc, chriscct7.
Fixes #29885.
Built from https://develop.svn.wordpress.org/trunk@29935


git-svn-id: http://core.svn.wordpress.org/trunk@29687 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-10-17 01:58:18 +00:00
Boone Gorges
7d8322aa65 WP_Comment_Query: comment__in, comment__not_in, post__in, post__not_in.
Props nofearinc, mordauk, boonebgorges

Fixes #25386
Built from https://develop.svn.wordpress.org/trunk@29808


git-svn-id: http://core.svn.wordpress.org/trunk@29574 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-10-02 01:41:16 +00:00
Mark Jaquith
0d3b83551f Use HTTPS URLs for core.trac.wordpress.org
see #27115
Built from https://develop.svn.wordpress.org/trunk@29788


git-svn-id: http://core.svn.wordpress.org/trunk@29560 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-09-29 13:28:16 +00:00
Drew Jaynes
dd25a715b2 Improve and clarify inline commenting inside the check_comment() function.
Adds logical explanations of what some of the various comment checks are checking for, as well as some general cleanup and syntax fixes.

Fixes #29734.

Built from https://develop.svn.wordpress.org/trunk@29763


git-svn-id: http://core.svn.wordpress.org/trunk@29535 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-09-23 18:49:17 +00:00
Drew Jaynes
9824f40920 Improve documentation in the check_comments() docblock.
* Removes two duplicate sentences from the long description
* Tightens up phrasing elsewhere in the long description for specific checks
* Clarifies the parameter and return descriptions, and adds periods

See #29734.

Built from https://develop.svn.wordpress.org/trunk@29762


git-svn-id: http://core.svn.wordpress.org/trunk@29534 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-09-23 18:47:15 +00:00
Sergey Biryukov
c6b70a9320 Correct references to post-template.php in the inline docs.
props softmodeling.
fixes #29188.
Built from https://develop.svn.wordpress.org/trunk@29469


git-svn-id: http://core.svn.wordpress.org/trunk@29247 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-08-12 01:09:17 +00:00
Dominik Schilling
2e4be94288 Replace is_https_url() with 'https' === parse_url( $url, PHP_URL_SCHEME ).
see #28427, #28487.
Built from https://develop.svn.wordpress.org/trunk@29311


git-svn-id: http://core.svn.wordpress.org/trunk@29092 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-07-27 17:46:17 +00:00
Drew Jaynes
3665b5a1a1 Add periods to short descriptions for magic methods added in [28501], [28521], and [28524].
See #22234 and #28885.

Built from https://develop.svn.wordpress.org/trunk@29165


git-svn-id: http://core.svn.wordpress.org/trunk@28949 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-07-14 01:12:14 +00:00
Drew Jaynes
c00e3d9a46 Fill out inline documentation for the __call() magic method added to the WP_Comment_Query class in [28519].
See #22234 and #28885.

Built from https://develop.svn.wordpress.org/trunk@29162


git-svn-id: http://core.svn.wordpress.org/trunk@28946 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-07-14 00:48:14 +00:00
Andrew Nacin
ba59fac708 WP_Comment_Query: Add fields => 'ids' query var.
props mordauk.
fixes #28434.

Built from https://develop.svn.wordpress.org/trunk@29045


git-svn-id: http://core.svn.wordpress.org/trunk@28833 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-07-09 18:16:15 +00:00
Sergey Biryukov
c8d8610a15 Avoid a PHP notice in wp_new_comment() if user ID is not passed.
see #23231.
Built from https://develop.svn.wordpress.org/trunk@28922


git-svn-id: http://core.svn.wordpress.org/trunk@28721 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-06-30 11:03:14 +00:00
Sergey Biryukov
c8adae8ec7 Normalize 'user_id' and 'user_ID' values in wp_new_comment() before passing the comment data to 'preprocess_comment' filter.
props dkotter.
fixes #23231.
Built from https://develop.svn.wordpress.org/trunk@28915


git-svn-id: http://core.svn.wordpress.org/trunk@28714 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-06-30 00:41:16 +00:00
John Blackbourn
60ff3a61f9 Conditionally set the the secure flag on the test cookie, post password cookie, settings cookies, and comment author cookies depending on whether the front end and/or admin area are served over https. Fixes #28427
Built from https://develop.svn.wordpress.org/trunk@28895


git-svn-id: http://core.svn.wordpress.org/trunk@28694 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-06-29 13:25:16 +00:00
Scott Taylor
e5e8a83cf4 Don't use variable variables in WP_Comment_Query::query().
See #27881.

Built from https://develop.svn.wordpress.org/trunk@28738


git-svn-id: http://core.svn.wordpress.org/trunk@28552 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-06-11 17:58:14 +00:00
Scott Taylor
5219bbbbc9 In WP_Comment_Query::get_search_sql(), don't double-like-escape.
Props miqrogroove.
See #10041.

Built from https://develop.svn.wordpress.org/trunk@28720


git-svn-id: http://core.svn.wordpress.org/trunk@28534 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-06-10 02:20:16 +00:00
Scott Taylor
05eeb16e30 Replace all uses of like_escape() with $wpdb->esc_like().
Props miqrogroove.
See #10041.

Built from https://develop.svn.wordpress.org/trunk@28712


git-svn-id: http://core.svn.wordpress.org/trunk@28528 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-06-10 00:44:15 +00:00
Sergey Biryukov
02657dcd66 wp_insert_comment() and wp_new_comment() should check if the comment was successfully inserted into the database.
props pento.
fixes #28254.
Built from https://develop.svn.wordpress.org/trunk@28672


git-svn-id: http://core.svn.wordpress.org/trunk@28490 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-06-05 04:38:14 +00:00
Drew Jaynes
3724252959 Ensure $post_id is documented as optional where applicable.
See #28388.

Built from https://develop.svn.wordpress.org/trunk@28654


git-svn-id: http://core.svn.wordpress.org/trunk@28472 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-06-03 04:44:16 +00:00
Scott Taylor
40fab485aa Add missing access modifiers to methods in WP_Comment_Query. Add a magic __call() method for BC.
See #27881, #22234.

Built from https://develop.svn.wordpress.org/trunk@28519


git-svn-id: http://core.svn.wordpress.org/trunk@28345 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-05-19 06:19:14 +00:00