Skip to:
Content

bbPress.org

Changeset 5502


Ignore:
Timestamp:
09/11/2014 02:41:33 PM (10 years ago)
Author:
johnjamesjacoby
Message:

Add pending topics to forum hidden topic counts. Props netweb. See #2645.

File:
1 edited

Legend:

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

    r5466 r5502  
    950950    delete_option( '_bbp_private_forums' );
    951951    delete_option( '_bbp_hidden_forums'  );
    952    
     952
    953953    /**
    954954     * Don't search for both private/hidden statuses. Since 'pre_get_posts' is an
    955      * action, it's not removed by suppress_filters. We need to make sure that 
     955     * action, it's not removed by suppress_filters. We need to make sure that
    956956     * we're only searching for the supplied post_status.
    957957     *
     
    975975        'fields'           => 'ids'
    976976    ) );
    977    
     977
    978978    // Enable forum visibilty normalization
    979979    add_action( 'pre_get_posts', 'bbp_pre_get_posts_normalize_forum_visibility', 4 );
     
    10971097 * @param int $difference Optional. Default 1
    10981098 * @uses bbp_get_forum_id() To get the forum id
     1099 * @uses bbp_get_forum_topic_count_hidden To get the forum's hidden topic count
    10991100 * @uses update_post_meta() To update the forum's topic count meta
    11001101 * @uses apply_filters() Calls 'bbp_bump_forum_topic_count_hidden' with the
     
    14631464
    14641465/**
    1465  * Adjust the total hidden topic count of a forum (hidden includes trashed and spammed topics)
     1466 * Adjust the total hidden topic count of a forum (hidden includes trashed,
     1467 * spammed and pending topics)
    14661468 *
    14671469 * @since bbPress (r2888)
     
    14731475 * @uses bbp_get_topic_forum_id() To get the topic forum id
    14741476 * @uses bbp_get_forum_id() To get the forum id
     1477 * @uses bbp_get_trash_status_id() To get the trash status id
     1478 * @uses bbp_get_spam_status_id() To get the spam status id
     1479 * @uses bbp_get_pending_status_id() To get the pending status id
    14751480 * @uses wpdb::prepare() To prepare our sql query
    1476  * @uses wpdb::get_col() To execute our query and get the column back
     1481 * @uses wpdb::get_var() To execute our query and get the var back
    14771482 * @uses update_post_meta() To update the forum hidden topic count meta
    14781483 * @uses apply_filters() Calls 'bbp_update_forum_topic_count_hidden' with the
     
    14941499
    14951500    // Can't update what isn't there
    1496     if ( !empty( $forum_id ) ) {
     1501    if ( ! empty( $forum_id ) ) {
    14971502
    14981503        // Get topics of forum
    14991504        if ( empty( $topic_count ) ) {
    1500             $post_status = "'" . implode( "','", array( bbp_get_trash_status_id(), bbp_get_spam_status_id() ) ) . "'";
     1505            $post_status = "'" . implode( "','", array( bbp_get_trash_status_id(), bbp_get_spam_status_id(), bbp_get_pending_status_id() ) ) . "'";
    15011506            $topic_count = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(ID) FROM {$wpdb->posts} WHERE post_parent = %d AND post_status IN ( {$post_status} ) AND post_type = '%s';", $forum_id, bbp_get_topic_post_type() ) );
    15021507        }
Note: See TracChangeset for help on using the changeset viewer.