Changeset 6848 for trunk/src/includes/forums/functions.php
- Timestamp:
- 08/09/2018 07:53:28 PM (7 years ago)
- File:
-
- 1 edited
-
trunk/src/includes/forums/functions.php (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/includes/forums/functions.php
r6814 r6848 75 75 // Update the forum and hierarchy 76 76 bbp_update_forum( array( 77 'forum_id' => $forum_id 77 'forum_id' => $forum_id, 78 'post_parent' => $forum_data['post_parent'] 78 79 ) ); 79 80 … … 99 100 */ 100 101 do_action( 'bbp_insert_forum', (int) $forum_id ); 102 103 // Bump the last changed cache 104 wp_cache_set( 'last_changed', microtime(), 'bbpress_posts' ); 101 105 102 106 // Return forum_id … … 1367 1371 1368 1372 // Get the topic's replies. 1369 $replies = bbp_get_public_child_ids( $topic_id, bbp_get_reply_post_type() ); 1370 $count = count( $replies ); 1373 $count = bbp_get_public_child_count( $topic_id, bbp_get_reply_post_type() ); 1371 1374 1372 1375 // If we're unapproving, set count to negative. … … 1593 1596 $forum_id = bbp_get_forum_id( $forum_id ); 1594 1597 1598 // Maybe query for counts 1595 1599 if ( empty( $subforums ) ) { 1596 $subforums = count( bbp_forum_query_subforum_ids( $forum_id) );1600 $subforums = bbp_get_public_child_count( $forum_id, bbp_get_forum_post_type() ); 1597 1601 } 1598 1602 … … 1629 1633 1630 1634 // Get total topics for this forum 1631 $topics = (int) count( bbp_forum_query_topic_ids( $forum_id) );1635 $topics = bbp_get_public_child_count( $forum_id, bbp_get_topic_post_type() ); 1632 1636 1633 1637 // Calculate total topics in this forum … … 1729 1733 $topic_ids = bbp_forum_query_topic_ids( $forum_id ); 1730 1734 if ( ! empty( $topic_ids ) ) { 1731 $query = new WP_Query( array( 1732 'fields' => 'ids', 1733 'post_parent__in' => $topic_ids, 1734 'post_status' => bbp_get_public_status_id(), 1735 'post_type' => bbp_get_reply_post_type(), 1736 'posts_per_page' => -1, 1737 1738 // Performance 1739 'nopaging' => true, 1740 'suppress_filters' => true, 1741 'update_post_term_cache' => false, 1742 'update_post_meta_cache' => false, 1743 'ignore_sticky_posts' => true, 1744 'no_found_rows' => true 1745 ) ); 1746 $reply_count = ! empty( $query->posts ) ? count( $query->posts ) : 0; 1747 unset( $query ); 1735 $reply_count = bbp_get_public_child_count( $forum_id, bbp_get_reply_post_type() ); 1748 1736 } 1749 1737 … … 1788 1776 ), 'update_forum' ); 1789 1777 1778 // Update the forum parent 1779 bbp_update_forum_id( $r['forum_id'], $r['post_parent'] ); 1780 1790 1781 // Last topic and reply ID's 1791 1782 bbp_update_forum_last_topic_id( $r['forum_id'], $r['last_topic_id'] ); … … 1821 1812 ) ); 1822 1813 } 1814 1815 // Bump the custom query cache 1816 wp_cache_set( 'last_changed', microtime(), 'bbpress_posts' ); 1823 1817 } 1824 1818
Note: See TracChangeset
for help on using the changeset viewer.