Changeset 6685
- Timestamp:
- 09/09/2017 03:00:07 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2.5/includes/common/functions.php
r6647 r6685 497 497 if ( current_user_can( 'read_private_topics' ) || current_user_can( 'edit_others_topics' ) || current_user_can( 'view_trash' ) ) { 498 498 499 // Declare empty arrays 500 $topics = $topic_titles = array(); 499 // Declare empty arrays 500 $topics = $topic_titles = array(); 501 501 502 502 // Private … … 532 532 if ( current_user_can( 'read_private_replies' ) || current_user_can( 'edit_others_replies' ) || current_user_can( 'view_trash' ) ) { 533 533 534 // Declare empty arrays 535 $replies = $reply_titles = array(); 534 // Declare empty arrays 535 $replies = $reply_titles = array(); 536 536 537 537 // Private … … 1640 1640 $child_ids = wp_cache_get( $cache_id, 'bbpress_posts' ); 1641 1641 if ( false === $child_ids ) { 1642 $post_status = array( bbp_get_public_status_id() ); 1643 1644 // Extra post statuses based on post type 1645 switch ( $post_type ) { 1646 1647 // Forum 1648 case bbp_get_forum_post_type() : 1649 $post_status[] = bbp_get_private_status_id(); 1650 $post_status[] = bbp_get_hidden_status_id(); 1651 break; 1652 1653 // Topic 1654 case bbp_get_topic_post_type() : 1655 $post_status[] = bbp_get_closed_status_id(); 1656 $post_status[] = bbp_get_trash_status_id(); 1657 $post_status[] = bbp_get_spam_status_id(); 1658 break; 1659 1660 // Reply 1661 case bbp_get_reply_post_type() : 1662 $post_status[] = bbp_get_trash_status_id(); 1663 $post_status[] = bbp_get_spam_status_id(); 1664 break; 1665 } 1666 1667 // Join post statuses together 1668 $post_status = "'" . implode( "', '", $post_status ) . "'"; 1669 1670 $child_ids = $wpdb->get_col( $wpdb->prepare( "SELECT ID FROM {$wpdb->posts} WHERE post_parent = %d AND post_status IN ( {$post_status} ) AND post_type = '%s' ORDER BY ID DESC;", $parent_id, $post_type ) ); 1642 1643 // Join post statuses to specifically exclude together 1644 $not_in = array( 'draft', 'future' ); 1645 $post_status = "'" . implode( "', '", $not_in ) . "'"; 1646 1647 $child_ids = $wpdb->get_col( $wpdb->prepare( "SELECT ID FROM {$wpdb->posts} WHERE post_parent = %d AND post_status NOT IN ( {$post_status} ) AND post_type = '%s' ORDER BY ID DESC;", $parent_id, $post_type ) ); 1671 1648 wp_cache_set( $cache_id, $child_ids, 'bbpress_posts' ); 1672 1649 }
Note: See TracChangeset
for help on using the changeset viewer.