Skip to:
Content

bbPress.org


Ignore:
Timestamp:
05/11/2013 06:10:20 AM (13 years ago)
Author:
johnjamesjacoby
Message:

Use implode() instead of join() through-out project. See #2331.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/includes/forums/functions.php

    r4876 r4896  
    13631363        // Get topics of forum
    13641364        if ( empty( $topic_count ) )
    1365             $topic_count = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(ID) FROM {$wpdb->posts} WHERE post_parent = %d AND post_status IN ( '" . join( '\',\'', array( bbp_get_trash_status_id(), bbp_get_spam_status_id() ) ) . "') AND post_type = '%s';", $forum_id, bbp_get_topic_post_type() ) );
     1365            $topic_count = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(ID) FROM {$wpdb->posts} WHERE post_parent = %d AND post_status IN ( '" . implode( '\',\'', array( bbp_get_trash_status_id(), bbp_get_spam_status_id() ) ) . "') AND post_type = '%s';", $forum_id, bbp_get_topic_post_type() ) );
    13661366
    13671367        // Update the count
     
    14101410    $topic_ids = bbp_forum_query_topic_ids( $forum_id );
    14111411    if ( !empty( $topic_ids ) ) {
    1412         $reply_count = (int) $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(ID) FROM {$wpdb->posts} WHERE post_parent IN ( " . join( ',', $topic_ids ) . " ) AND post_status = '%s' AND post_type = '%s';", bbp_get_public_status_id(), bbp_get_reply_post_type() ) );
     1412        $reply_count = (int) $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(ID) FROM {$wpdb->posts} WHERE post_parent IN ( " . implode( ',', $topic_ids ) . " ) AND post_status = '%s' AND post_type = '%s';", bbp_get_public_status_id(), bbp_get_reply_post_type() ) );
    14131413    } else {
    14141414        $reply_count = 0;
     
    18061806
    18071807        if ( !empty( $topic_ids ) ) {
    1808             $reply_id = (int) $wpdb->get_var( $wpdb->prepare( "SELECT ID FROM {$wpdb->posts} WHERE post_parent IN ( " . join( ',', $topic_ids ) . " ) AND post_status = '%s' AND post_type = '%s' ORDER BY ID DESC LIMIT 1;", bbp_get_public_status_id(), bbp_get_reply_post_type() ) );
     1808            $reply_id = (int) $wpdb->get_var( $wpdb->prepare( "SELECT ID FROM {$wpdb->posts} WHERE post_parent IN ( " . implode( ',', $topic_ids ) . " ) AND post_status = '%s' AND post_type = '%s' ORDER BY ID DESC LIMIT 1;", bbp_get_public_status_id(), bbp_get_reply_post_type() ) );
    18091809            wp_cache_set( $cache_id, $reply_id, 'bbpress_posts' ); // May be (int) 0
    18101810        } else {
     
    20222022
    20232023    // Allowed post statuses to pre-trash
    2024     $post_stati = join( ',', array(
     2024    $post_stati = implode( ',', array(
    20252025        bbp_get_public_status_id(),
    20262026        bbp_get_closed_status_id(),
Note: See TracChangeset for help on using the changeset viewer.