Changeset 6922 for trunk/src/includes/common/functions.php
- Timestamp:
- 11/07/2019 07:40:16 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/includes/common/functions.php
r6920 r6922 1869 1869 // Forum 1870 1870 case bbp_get_forum_post_type() : 1871 $post_status = array( bbp_get_private_status_id(), bbp_get_hidden_status_id());1871 $post_status = bbp_get_non_public_forum_statuses(); 1872 1872 break; 1873 1873 … … 1879 1879 // Reply 1880 1880 case bbp_get_reply_post_type() : 1881 $post_status = bbp_get_non_public_reply_statuses(); 1882 break; 1883 1884 // Any 1881 1885 default : 1882 $post_status = bbp_get_ non_public_reply_statuses();1886 $post_status = bbp_get_public_status_id(); 1883 1887 break; 1884 1888 } … … 1912 1916 } 1913 1917 1914 // Get the public post status 1915 $post_status = array( bbp_get_public_status_id() ); 1916 1917 // Add closed status if topic post type 1918 if ( bbp_get_topic_post_type() === $post_type ) { 1919 $post_status[] = bbp_get_closed_status_id(); 1918 // Which statuses 1919 switch ( $post_type ) { 1920 1921 // Forum 1922 case bbp_get_forum_post_type() : 1923 $post_status = bbp_get_public_forum_statuses(); 1924 break; 1925 1926 // Topic 1927 case bbp_get_topic_post_type() : 1928 $post_status = bbp_get_public_topic_statuses(); 1929 break; 1930 1931 // Reply 1932 case bbp_get_reply_post_type() : 1933 default : 1934 $post_status = bbp_get_public_reply_statuses(); 1935 break; 1920 1936 } 1921 1937 … … 1939 1955 'no_found_rows' => true 1940 1956 ) ); 1941 $child_ids = ! empty( $query->posts ) ? $query->posts : array(); 1957 1958 $child_ids = ! empty( $query->posts ) 1959 ? $query->posts 1960 : array(); 1961 1942 1962 unset( $query ); 1943 1963 … … 1963 1983 } 1964 1984 1965 // Check cache key 1966 $key = md5( serialize( array( 'parent_id' => $parent_id, 'post_type' => $post_type ) ) ); 1985 // Make cache key 1986 $not_in = array( 'draft', 'future' ); 1987 $key = md5( serialize( array( 1988 'parent_id' => $parent_id, 1989 'post_type' => $post_type, 1990 'post_status' => $not_in 1991 ) ) ); 1992 1993 // Check last changed 1967 1994 $last_changed = wp_cache_get_last_changed( 'bbpress_posts' ); 1968 1995 $cache_key = "bbp_child_ids:{$key}:{$last_changed}"; … … 1970 1997 // Check for cache and set if needed 1971 1998 $child_ids = wp_cache_get( $cache_key, 'bbpress_posts' ); 1999 2000 // Not already cached 1972 2001 if ( false === $child_ids ) { 1973 2002 1974 2003 // Join post statuses to specifically exclude together 1975 $not_in = array( 'draft', 'future' );1976 2004 $post_status = "'" . implode( "', '", $not_in ) . "'"; 1977 2005 $bbp_db = bbp_db();
Note: See TracChangeset
for help on using the changeset viewer.