Make WordPress Core

Ticket #17020: get-approved-comments-3.2.diff

File get-approved-comments-3.2.diff, 745 bytes (added by adamsewell, 14 years ago)

Modifies the get_approved_comments function to use get_comments

  • wp-includes/comment.php

     
    105105 * @param int $post_id The ID of the post
    106106 * @return array $comments The approved comments
    107107 */
    108 function get_approved_comments($post_id) {
    109         global $wpdb;
    110         return $wpdb->get_results($wpdb->prepare("SELECT * FROM $wpdb->comments WHERE comment_post_ID = %d AND comment_approved = '1' ORDER BY comment_date", $post_id));
     108function get_approved_comments($post_id) {             
     109        $comment_args = array(
     110                'post_id' => $post_id,
     111                'status' => 'approved',
     112                'orderby' => 'comment_date',
     113                );
     114       
     115        return get_comments( $comment_args );
    111116}
    112117
    113118/**