Skip to:
Content

bbPress.org

Ticket #3083: 3083.patch

File 3083.patch, 1.2 KB (added by johnjamesjacoby, 8 years ago)

For 2.6

  • src/includes/topics/functions.php

     
    29822982        delete_post_meta( $topic_id, '_bbp_engagement' );
    29832983
    29842984        // Query the DB to get voices in this topic
     2985        // See: https://bbpress.trac.wordpress.org/ticket/3083
    29852986        $bbp_db  = bbp_db();
    2986         $sql     = "SELECT DISTINCT post_author FROM {$bbp_db->posts} WHERE ( post_parent = %d AND post_status = %s AND post_type = %s ) OR ( ID = %d AND post_type = %s )";
    2987         $query   = $bbp_db->prepare( $sql, $topic_id, bbp_get_public_status_id(), bbp_get_reply_post_type(), $topic_id, bbp_get_topic_post_type() );
     2987        $sql     = "SELECT DISTINCT( post_author ) FROM (
     2988                                        SELECT post_author FROM {$bbp_db->posts}
     2989                                                WHERE ( ID = %d AND post_type = %s )
     2990                                        UNION
     2991                                        SELECT post_author FROM {$bbp_db->posts} 
     2992                                                WHERE ( post_parent = %d AND post_status = %s AND post_type = %s )
     2993                                ) as u1";
     2994        $query   = $bbp_db->prepare( $sql, $topic_id, bbp_get_topic_post_type(), $topic_id, bbp_get_public_status_id(), bbp_get_reply_post_type() );
    29882995        $results = $bbp_db->get_col( $query );
    29892996
    29902997        // Parse results into voices