Changeset 6643 for trunk/src/includes/common/functions.php
- Timestamp:
- 08/07/2017 08:23:18 PM (9 years ago)
- File:
-
- 1 edited
-
trunk/src/includes/common/functions.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/includes/common/functions.php
r6616 r6643 1608 1608 1609 1609 /** 1610 * Query the DB and get athe child id's of all children1610 * Query the DB and get the child id's of all children 1611 1611 * 1612 1612 * @since 2.0.0 bbPress (r3325) … … 1632 1632 $child_ids = wp_cache_get( $cache_key, 'bbpress_posts' ); 1633 1633 if ( false === $child_ids ) { 1634 $post_status = array( bbp_get_public_status_id() ); 1635 1636 // Extra post statuses based on post type 1637 switch ( $post_type ) { 1638 1639 // Forum 1640 case bbp_get_forum_post_type() : 1641 $post_status[] = bbp_get_private_status_id(); 1642 $post_status[] = bbp_get_hidden_status_id(); 1643 break; 1644 1645 // Topic 1646 case bbp_get_topic_post_type() : 1647 $post_status[] = bbp_get_pending_status_id(); 1648 $post_status[] = bbp_get_closed_status_id(); 1649 $post_status[] = bbp_get_trash_status_id(); 1650 $post_status[] = bbp_get_spam_status_id(); 1651 break; 1652 1653 // Reply 1654 case bbp_get_reply_post_type() : 1655 $post_status[] = bbp_get_pending_status_id(); 1656 $post_status[] = bbp_get_trash_status_id(); 1657 $post_status[] = bbp_get_spam_status_id(); 1658 break; 1659 } 1660 1661 // Join post statuses together 1662 $post_status = "'" . implode( "', '", $post_status ) . "'"; 1634 1635 // Join post statuses to specifically exclude together 1636 $not_in = array( 'draft', 'future' ); 1637 $post_status = "'" . implode( "', '", $not_in ) . "'"; 1663 1638 $bbp_db = bbp_db(); 1664 1639 1665 1640 // Note that we can't use WP_Query here thanks to post_status assumptions 1666 $query = $bbp_db->prepare( "SELECT ID FROM {$bbp_db->posts} WHERE post_parent = %d AND post_status IN ( {$post_status} ) AND post_type = %s ORDER BY ID DESC", $parent_id, $post_type );1641 $query = $bbp_db->prepare( "SELECT ID FROM {$bbp_db->posts} WHERE post_parent = %d AND post_status NOT IN ( {$post_status} ) AND post_type = %s ORDER BY ID DESC", $parent_id, $post_type ); 1667 1642 $child_ids = (array) $bbp_db->get_col( $query ); 1668 1643
Note: See TracChangeset
for help on using the changeset viewer.