Skip to:
Content

bbPress.org


Ignore:
Timestamp:
08/07/2017 08:27:00 PM (9 years ago)
Author:
johnjamesjacoby
Message:

Topics: Introduce bbp_get_non_public_topic_statuses()

This new function returns the inverse post-statuses of bbp_get_public_topic_statuses() with a filter to help target them more specifically in places where it was not previously possible to do so.

See #3128.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/includes/admin/tools/repair.php

    r6573 r6644  
    281281        // Post types and status
    282282        $rpt = bbp_get_reply_post_type();
    283         $tps = bbp_get_trash_status_id();
    284         $sps = bbp_get_spam_status_id();
    285         $pps = bbp_get_pending_status_id();
    286 
    287         $sql = "INSERT INTO `{$bbp_db->postmeta}` (`post_id`, `meta_key`, `meta_value`) (SELECT `post_parent`, '_bbp_reply_count_hidden', COUNT(`post_status`) as `meta_value` FROM `{$bbp_db->posts}` WHERE `post_type` = '{$rpt}' AND `post_status` IN ( '{$tps}', '{$sps}', '{$pps}' ) GROUP BY `post_parent`)";
     283        $sta = bbp_get_non_public_topic_statuses();
     284
     285        // SQL
     286        $sql_status = "'" . implode( "','", $sta ) . "'";
     287
     288        $sql = "INSERT INTO `{$bbp_db->postmeta}` (`post_id`, `meta_key`, `meta_value`) (SELECT `post_parent`, '_bbp_reply_count_hidden', COUNT(`post_status`) as `meta_value` FROM `{$bbp_db->posts}` WHERE `post_type` = '{$rpt}' AND `post_status` IN ({$sql_status}) GROUP BY `post_parent`)";
    288289        if ( is_wp_error( $bbp_db->query( $sql ) ) ) {
    289290                return array( 2, sprintf( $statement, $result ) );
Note: See TracChangeset for help on using the changeset viewer.