Skip to:
Content

bbPress.org


Ignore:
Timestamp:
07/16/2015 04:15:12 AM (10 years ago)
Author:
johnjamesjacoby
Message:

Queries: Clean up post status concatenation in 2 queries.

This changeset moves array of "hidden" type post-statuses into their own variable to better match existing usages.

Fixes #2826.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/includes/topics/functions.php

    r5837 r5858  
    25192519    // Get replies of topic
    25202520    if ( empty( $reply_count ) ) {
     2521        $statuses    = array( bbp_get_trash_status_id(), bbp_get_spam_status_id(), bbp_get_pending_status_id() );
     2522        $post_status = "'" . implode( "','", $statuses ) . "'";
    25212523        $bbp_db      = bbp_db();
    2522         $post_status = "'" . implode( "','", array( bbp_get_trash_status_id(), bbp_get_spam_status_id(), bbp_get_pending_status_id() ) ) . "'";
    25232524        $query       = $bbp_db->prepare( "SELECT COUNT(ID) FROM {$bbp_db->posts} WHERE post_parent = %d AND post_status IN ( {$post_status} ) AND post_type = '%s';", $topic_id, bbp_get_reply_post_type() );
    25242525        $reply_count = $bbp_db->get_var( $query );
Note: See TracChangeset for help on using the changeset viewer.