Changeset 6922
- Timestamp:
- 11/07/2019 07:40:16 PM (5 years ago)
- Location:
- trunk/src/includes
- Files:
-
- 6 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(); -
trunk/src/includes/forums/functions.php
r6855 r6922 1822 1822 * Return an associative array of available topic statuses 1823 1823 * 1824 * Developers note: these statuses are actually stored as meta data, and 1825 * Visibilities are stored in post_status. 1826 * 1824 1827 * @since 2.4.0 bbPress (r5059) 1825 1828 * … … 1857 1860 /** 1858 1861 * Return an associative array of forum visibility 1862 * 1863 * Developers note: these visibilities are actually stored in post_status, and 1864 * Statuses are stored in meta data. 1859 1865 * 1860 1866 * @since 2.4.0 bbPress (r5059) … … 1872 1878 bbp_get_hidden_status_id() => _x( 'Hidden', 'Make forum hidden', 'bbpress' ) 1873 1879 ), $forum_id ); 1880 } 1881 1882 /** 1883 * Return array of public forum statuses. 1884 * 1885 * @since 2.6.0 bbPress (r6921) 1886 * 1887 * @return array 1888 */ 1889 function bbp_get_public_forum_statuses() { 1890 $statuses = array( 1891 bbp_get_public_status_id() 1892 ); 1893 1894 // Filter & return 1895 return (array) apply_filters( 'bbp_get_public_forum_statuses', $statuses ); 1896 } 1897 1898 /** 1899 * Return array of non-public forum statuses. 1900 * 1901 * @since 2.6.0 bbPress (r6921) 1902 * 1903 * @return array 1904 */ 1905 function bbp_get_non_public_forum_statuses() { 1906 $statuses = array( 1907 bbp_get_private_status_id(), 1908 bbp_get_hidden_status_id() 1909 ); 1910 1911 // Filter & return 1912 return (array) apply_filters( 'bbp_get_non_public_forum_statuses', $statuses ); 1874 1913 } 1875 1914 … … 2143 2182 'no_found_rows' => true 2144 2183 ) ); 2184 2145 2185 $reply_id = array_shift( $query->posts ); 2186 2146 2187 unset( $query ); 2147 2188 -
trunk/src/includes/replies/functions.php
r6918 r6922 1662 1662 } 1663 1663 1664 /** 1665 * Return array of public reply statuses. 1666 * 1667 * @since 2.6.0 bbPress (r6705) 1668 * 1669 * @return array 1670 */ 1671 function bbp_get_public_reply_statuses() { 1672 $statuses = array( 1673 bbp_get_public_status_id() 1674 ); 1675 1676 // Filter & return 1677 return (array) apply_filters( 'bbp_get_public_reply_statuses', $statuses ); 1678 } 1679 1680 /** 1681 * Return array of non-public reply statuses. 1682 * 1683 * @since 2.6.0 bbPress (r6791) 1684 * 1685 * @return array 1686 */ 1687 function bbp_get_non_public_reply_statuses() { 1688 $statuses = array( 1689 bbp_get_trash_status_id(), 1690 bbp_get_spam_status_id(), 1691 bbp_get_pending_status_id() 1692 ); 1693 1694 // Filter & return 1695 return (array) apply_filters( 'bbp_get_non_public_reply_statuses', $statuses ); 1696 } 1697 1664 1698 /** Reply Actions *************************************************************/ 1665 1699 -
trunk/src/includes/replies/template.php
r6903 r6922 829 829 830 830 /** 831 * Return array of public reply statuses.832 *833 * @since 2.6.0 bbPress (r6705)834 *835 * @return array836 */837 function bbp_get_public_reply_statuses() {838 $statuses = array(839 bbp_get_public_status_id()840 );841 842 // Filter & return843 return (array) apply_filters( 'bbp_get_public_reply_statuses', $statuses );844 }845 846 /**847 * Return array of non-public reply statuses.848 *849 * @since 2.6.0 bbPress (r6791)850 *851 * @return array852 */853 function bbp_get_non_public_reply_statuses() {854 $statuses = array(855 bbp_get_trash_status_id(),856 bbp_get_spam_status_id(),857 bbp_get_pending_status_id()858 );859 860 // Filter & return861 return (array) apply_filters( 'bbp_get_non_public_reply_statuses', $statuses );862 }863 864 /**865 831 * Is the reply publicly viewable? 866 832 * -
trunk/src/includes/topics/functions.php
r6918 r6922 1900 1900 } 1901 1901 1902 /** 1903 * Return array of public topic statuses. 1904 * 1905 * @since 2.6.0 bbPress (r6383) 1906 * 1907 * @return array 1908 */ 1909 function bbp_get_public_topic_statuses() { 1910 $statuses = array( 1911 bbp_get_public_status_id(), 1912 bbp_get_closed_status_id() 1913 ); 1914 1915 // Filter & return 1916 return (array) apply_filters( 'bbp_get_public_topic_statuses', $statuses ); 1917 } 1918 1919 /** 1920 * Return array of non-public topic statuses. 1921 * 1922 * @since 2.6.0 bbPress (r6642) 1923 * 1924 * @return array 1925 */ 1926 function bbp_get_non_public_topic_statuses() { 1927 $statuses = array( 1928 bbp_get_trash_status_id(), 1929 bbp_get_spam_status_id(), 1930 bbp_get_pending_status_id() 1931 ); 1932 1933 // Filter & return 1934 return (array) apply_filters( 'bbp_get_non_public_topic_statuses', $statuses ); 1935 } 1936 1902 1937 /** Stickies ******************************************************************/ 1903 1938 … … 3635 3670 3636 3671 // Statuses to count 3637 $object_statuses = array( 3638 bbp_get_public_status_id(), 3639 bbp_get_closed_status_id() 3640 ); 3672 $object_statuses = bbp_get_public_topic_statuses(); 3641 3673 3642 3674 // Get database -
trunk/src/includes/topics/template.php
r6921 r6922 1056 1056 1057 1057 /** 1058 * Return array of public topic statuses.1059 *1060 * @since 2.6.0 bbPress (r6383)1061 *1062 * @return array1063 */1064 function bbp_get_public_topic_statuses() {1065 $statuses = array(1066 bbp_get_public_status_id(),1067 bbp_get_closed_status_id()1068 );1069 1070 // Filter & return1071 return (array) apply_filters( 'bbp_get_public_topic_statuses', $statuses );1072 }1073 1074 /**1075 * Return array of non-public topic statuses.1076 *1077 * @since 2.6.0 bbPress (r6642)1078 *1079 * @return array1080 */1081 function bbp_get_non_public_topic_statuses() {1082 $statuses = array(1083 bbp_get_trash_status_id(),1084 bbp_get_spam_status_id(),1085 bbp_get_pending_status_id()1086 );1087 1088 // Filter & return1089 return (array) apply_filters( 'bbp_get_non_public_topic_statuses', $statuses );1090 }1091 1092 /**1093 1058 * Is the topic closed to new replies? 1094 1059 *
Note: See TracChangeset
for help on using the changeset viewer.