Changeset 32461
- Timestamp:
- 05/08/2015 07:44:06 PM (9 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/comment.php
r32364 r32461 697 697 // Parse comment IDs for an IN clause. 698 698 if ( ! empty( $this->query_vars['comment__in'] ) ) { 699 $where[] = 'comment_ID IN ( '. implode( ',', wp_parse_id_list( $this->query_vars['comment__in'] ) ) . ' )';699 $where[] = "$wpdb->comments.comment_ID IN ( " . implode( ',', wp_parse_id_list( $this->query_vars['comment__in'] ) ) . ' )'; 700 700 } 701 701 702 702 // Parse comment IDs for a NOT IN clause. 703 703 if ( ! empty( $this->query_vars['comment__not_in'] ) ) { 704 $where[] = 'comment_ID NOT IN ( '. implode( ',', wp_parse_id_list( $this->query_vars['comment__not_in'] ) ) . ' )';704 $where[] = "$wpdb->comments.comment_ID NOT IN ( " . implode( ',', wp_parse_id_list( $this->query_vars['comment__not_in'] ) ) . ' )'; 705 705 } 706 706 -
trunk/tests/phpunit/tests/comment/query.php
r31793 r32461 723 723 } 724 724 725 /** 726 * @group 32081 727 */ 728 public function test_meta_query_should_work_with_comment__in() { 729 $comments = $this->factory->comment->create_many( 3 ); 730 731 add_comment_meta( $comments[0], 'foo', 'jjj' ); 732 add_comment_meta( $comments[1], 'foo', 'zzz' ); 733 add_comment_meta( $comments[2], 'foo', 'jjj' ); 734 735 $q = new WP_Comment_Query( array( 736 'comment__in' => array( $comments[1], $comments[2] ), 737 'meta_query' => array( 738 array( 739 'key' => 'foo', 740 'value' => 'jjj', 741 ), 742 ), 743 'fields' => 'ids', 744 ) ); 745 746 $this->assertEquals( array( $comments[2] ), $q->get_comments() ); 747 } 748 749 /** 750 * @group 32081 751 */ 752 public function test_meta_query_should_work_with_comment__not_in() { 753 $comments = $this->factory->comment->create_many( 3 ); 754 755 add_comment_meta( $comments[0], 'foo', 'jjj' ); 756 add_comment_meta( $comments[1], 'foo', 'zzz' ); 757 add_comment_meta( $comments[2], 'foo', 'jjj' ); 758 759 $q = new WP_Comment_Query( array( 760 'comment__not_in' => array( $comments[1], $comments[2] ), 761 'meta_query' => array( 762 array( 763 'key' => 'foo', 764 'value' => 'jjj', 765 ), 766 ), 767 'fields' => 'ids', 768 ) ); 769 770 $this->assertEquals( array( $comments[0] ), $q->get_comments() ); 771 } 725 772 726 773 /**
Note: See TracChangeset
for help on using the changeset viewer.