Introduce 'author_url' param to `WP_Comment_Query`.

Props swissspidy.
Fixes #35377.
Built from https://develop.svn.wordpress.org/trunk@36224


git-svn-id: http://core.svn.wordpress.org/trunk@36191 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Boone Gorges 2016-01-08 21:52:27 +00:00
parent ae1575bd80
commit 5b4b4fc479
2 changed files with 8 additions and 1 deletions

View File

@ -139,12 +139,14 @@ class WP_Comment_Query {
* @since 4.4.0 `$parent__in` and `$parent__not_in` were added. * @since 4.4.0 `$parent__in` and `$parent__not_in` were added.
* @since 4.4.0 Order by `comment__in` was added. `$update_comment_meta_cache`, `$no_found_rows`, * @since 4.4.0 Order by `comment__in` was added. `$update_comment_meta_cache`, `$no_found_rows`,
* `$hierarchical`, and `$update_comment_post_cache` were added. * `$hierarchical`, and `$update_comment_post_cache` were added.
* @since 4.5.0 `$author_url` was added.
* @access public * @access public
* *
* @param string|array $query { * @param string|array $query {
* Optional. Array or query string of comment query parameters. Default empty. * Optional. Array or query string of comment query parameters. Default empty.
* *
* @type string $author_email Comment author email address. Default empty. * @type string $author_email Comment author email address. Default empty.
* @type string $author_url Comment author URL. Default empty.
* @type array $author__in Array of author IDs to include comments for. Default empty. * @type array $author__in Array of author IDs to include comments for. Default empty.
* @type array $author__not_in Array of author IDs to exclude comments for. Default empty. * @type array $author__not_in Array of author IDs to exclude comments for. Default empty.
* @type array $comment__in Array of comment IDs to include. Default empty. * @type array $comment__in Array of comment IDs to include. Default empty.
@ -245,6 +247,7 @@ class WP_Comment_Query {
public function __construct( $query = '' ) { public function __construct( $query = '' ) {
$this->query_var_defaults = array( $this->query_var_defaults = array(
'author_email' => '', 'author_email' => '',
'author_url' => '',
'author__in' => '', 'author__in' => '',
'author__not_in' => '', 'author__not_in' => '',
'include_unapproved' => '', 'include_unapproved' => '',
@ -670,6 +673,10 @@ class WP_Comment_Query {
$this->sql_clauses['where']['author_email'] = $wpdb->prepare( 'comment_author_email = %s', $this->query_vars['author_email'] ); $this->sql_clauses['where']['author_email'] = $wpdb->prepare( 'comment_author_email = %s', $this->query_vars['author_email'] );
} }
if ( '' !== $this->query_vars['author_url'] ) {
$this->sql_clauses['where']['author_url'] = $wpdb->prepare( 'comment_author_url = %s', $this->query_vars['author_url'] );
}
if ( '' !== $this->query_vars['karma'] ) { if ( '' !== $this->query_vars['karma'] ) {
$this->sql_clauses['where']['karma'] = $wpdb->prepare( 'comment_karma = %d', $this->query_vars['karma'] ); $this->sql_clauses['where']['karma'] = $wpdb->prepare( 'comment_karma = %d', $this->query_vars['karma'] );
} }

View File

@ -4,7 +4,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '4.5-alpha-36223'; $wp_version = '4.5-alpha-36224';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.