Make WordPress Core

Ticket #20006: get_comments.patch

File get_comments.patch, 1.6 KB (added by nprasath002, 12 years ago)

Support array of args

  • comment.php

    # This patch file was generated by NetBeans IDE
    # Following Index: paths are relative to: C:\xampp\htdocs\wordtrunk\wp-includes
    # This patch can be applied using context Tools: Patch action on respective folder.
    # It uses platform neutral UTF-8 encoding and \n newlines.
    # Above lines and this line are ignored by the patching process.
     
    327327                $post_fields = array_filter( compact( array( 'post_author', 'post_name', 'post_parent', 'post_status', 'post_type', ) ) );
    328328                if ( ! empty( $post_fields ) ) {
    329329                        $join = "JOIN $wpdb->posts ON $wpdb->posts.ID = $wpdb->comments.comment_post_ID";
    330                         foreach( $post_fields as $field_name => $field_value )
    331                                 $where .= $wpdb->prepare( " AND {$wpdb->posts}.{$field_name} = %s", $field_value );
     330                        foreach( $post_fields as $field_name => $field_value ) {
     331                                $field_value = (array)$field_value;
     332                                $where .= $wpdb->prepare( " AND ( {$wpdb->posts}.{$field_name} = %s", array_pop($field_value));
     333                                foreach ( $field_value as $value ) {
     334                                        $where .= $wpdb->prepare( " OR {$wpdb->posts}.{$field_name} = %s", $value );
    332335                }
     336                                $where .= $wpdb->prepare( " ) ");
     337                        }
     338                }
    333339
    334340                $pieces = array( 'fields', 'join', 'where', 'orderby', 'order', 'limits' );
    335341                $clauses = apply_filters_ref_array( 'comments_clauses', array( compact( $pieces ), &$this ) );