| @@ -653,9 +653,9 @@ | ||
| 653 | 653 | |
| 654 | 654 | /** |
| 655 | 655 | * Filter forum data submitted through the WordPress administration area. |
| 656 | 656 | * |
| 657 | - * @since 2.6.17 bbPress | |
| 657 | + * @since 2.6.17 bbPress (r7490) | |
| 658 | 658 | * |
| 659 | 659 | * @param array $data Sanitized post data. |
| 660 | 660 | * @param array $postarr Raw post data. |
| 661 | 661 | * @return array Filtered post data. |
| @@ -690,9 +690,9 @@ | ||
| 690 | 690 | |
| 691 | 691 | /** |
| 692 | 692 | * Handle the saving of core forum metadata (Status, Visibility, and Type) |
| 693 | 693 | * |
| 694 | - * @since 2.1.0 bbPress (r3678) | |
| 694 | + * @since 2.1.0 bbPress (r3679) | |
| 695 | 695 | * |
| 696 | 696 | * @param int $forum_id |
| 697 | 697 | * @return If forum ID is empty |
| 698 | 698 | */ |
| @@ -762,9 +762,9 @@ | ||
| 762 | 762 | |
| 763 | 763 | /** |
| 764 | 764 | * Allow custom forum visibility save actions |
| 765 | 765 | * |
| 766 | - * @since 2.6.0 bbPress (r5855) | |
| 766 | + * @since 2.6.0 bbPress (r5856) | |
| 767 | 767 | * |
| 768 | 768 | * @param int $forum_id The forum ID |
| 769 | 769 | * @param string $old_visibility The current forum visibility |
| 770 | 770 | * @param string $new_visibility The new forum visibility |
| @@ -891,51 +891,100 @@ | ||
| 891 | 891 | |
| 892 | 892 | /** Forum Visibility **********************************************************/ |
| 893 | 893 | |
| 894 | 894 | /** |
| 895 | - * Mark the forum as public | |
| 895 | + * Update the cached forum visibility options. | |
| 896 | 896 | * |
| 897 | - * @since 2.0.0 bbPress (r2746) | |
| 897 | + * This function only synchronizes the private and hidden forum ID options. It | |
| 898 | + * does not update the forum post status or fire any status transition actions. | |
| 898 | 899 | * |
| 899 | - * @param int $forum_id Optional. Forum id | |
| 900 | - * @return bool False on failure, true on success | |
| 900 | + * @since 2.6.19 bbPress | |
| 901 | + * | |
| 902 | + * @param int $forum_id Optional. Forum ID. | |
| 903 | + * @param string $visibility Optional. Forum visibility. | |
| 904 | + * @return int|false Forum ID on success, false on failure. | |
| 901 | 905 | */ |
| 902 | -function bbp_publicize_forum( $forum_id = 0, $current_visibility = '' ) { | |
| 906 | +function bbp_update_forum_visibility_options( $forum_id = 0, $visibility = '' ) { | |
| 903 | 907 | |
| 904 | 908 | $forum_id = bbp_get_forum_id( $forum_id ); |
| 909 | + $allowed = array( | |
| 910 | + bbp_get_public_status_id(), | |
| 911 | + bbp_get_private_status_id(), | |
| 912 | + bbp_get_hidden_status_id() | |
| 913 | + ); | |
| 905 | 914 | |
| 906 | - do_action( 'bbp_publicize_forum', $forum_id ); | |
| 915 | + // Bail if the forum or visibility is invalid | |
| 916 | + if ( empty( $forum_id ) || ! in_array( $visibility, $allowed, true ) ) { | |
| 917 | + return false; | |
| 918 | + } | |
| 907 | 919 | |
| 908 | - // Get private forums | |
| 909 | - $private = bbp_get_private_forum_ids(); | |
| 920 | + // Remove the forum from both visibility options | |
| 921 | + $private = bbp_get_unique_array_values( wp_parse_id_list( get_option( '_bbp_private_forums', array() ) ) ); | |
| 922 | + $hidden = bbp_get_unique_array_values( wp_parse_id_list( get_option( '_bbp_hidden_forums', array() ) ) ); | |
| 923 | + $old_private = $private; | |
| 924 | + $old_hidden = $hidden; | |
| 910 | 925 | |
| 911 | - // Find this forum in the array | |
| 912 | - if ( in_array( $forum_id, $private, true ) ) { | |
| 926 | + $private = array_diff( $private, array( $forum_id ) ); | |
| 927 | + $hidden = array_diff( $hidden, array( $forum_id ) ); | |
| 913 | 928 | |
| 914 | - $offset = array_search( $forum_id, $private, true ); | |
| 929 | + // Add the forum to its current visibility option | |
| 930 | + if ( bbp_get_private_status_id() === $visibility ) { | |
| 931 | + $private[] = $forum_id; | |
| 932 | + } elseif ( bbp_get_hidden_status_id() === $visibility ) { | |
| 933 | + $hidden[] = $forum_id; | |
| 934 | + } | |
| 915 | 935 | |
| 916 | - // Splice around it | |
| 917 | - array_splice( $private, $offset, 1 ); | |
| 936 | + // Update only the visibility options that changed | |
| 937 | + $private = bbp_get_unique_array_values( $private ); | |
| 938 | + $hidden = bbp_get_unique_array_values( $hidden ); | |
| 918 | 939 | |
| 919 | - // Update private forums minus this one | |
| 920 | - update_option( '_bbp_private_forums', bbp_get_unique_array_values( $private ) ); | |
| 940 | + if ( $private !== $old_private ) { | |
| 941 | + update_option( '_bbp_private_forums', $private ); | |
| 921 | 942 | } |
| 922 | 943 | |
| 923 | - // Get hidden forums | |
| 924 | - $hidden = bbp_get_hidden_forum_ids(); | |
| 944 | + if ( $hidden !== $old_hidden ) { | |
| 945 | + update_option( '_bbp_hidden_forums', $hidden ); | |
| 946 | + } | |
| 925 | 947 | |
| 926 | - // Find this forum in the array | |
| 927 | - if ( in_array( $forum_id, $hidden, true ) ) { | |
| 948 | + return $forum_id; | |
| 949 | +} | |
| 928 | 950 | |
| 929 | - $offset = array_search( $forum_id, $hidden, true ); | |
| 951 | +/** | |
| 952 | + * Synchronize forum visibility options after a post status transition. | |
| 953 | + * | |
| 954 | + * @since 2.6.19 bbPress | |
| 955 | + * | |
| 956 | + * @param string $new_status New post status. | |
| 957 | + * @param string $old_status Old post status. | |
| 958 | + * @param WP_Post $post Post object. | |
| 959 | + */ | |
| 960 | +function bbp_update_forum_visibility_on_transition_post_status( $new_status = '', $old_status = '', $post = false ) { | |
| 930 | 961 | |
| 931 | - // Splice around it | |
| 932 | - array_splice( $hidden, $offset, 1 ); | |
| 962 | + // Bail if the status did not change or this is not a forum | |
| 963 | + if ( ( $new_status === $old_status ) || ! ( $post instanceof WP_Post ) || ( bbp_get_forum_post_type() !== $post->post_type ) ) { | |
| 964 | + return; | |
| 965 | + } | |
| 933 | 966 | |
| 934 | - // Update hidden forums minus this one | |
| 935 | - update_option( '_bbp_hidden_forums', bbp_get_unique_array_values( $hidden ) ); | |
| 936 | - } | |
| 967 | + bbp_update_forum_visibility_options( $post->ID, $new_status ); | |
| 968 | +} | |
| 937 | 969 | |
| 970 | +/** | |
| 971 | + * Mark the forum as public | |
| 972 | + * | |
| 973 | + * @since 2.0.0 bbPress (r2746) | |
| 974 | + * | |
| 975 | + * @param int $forum_id Optional. Forum id | |
| 976 | + * @return bool False on failure, true on success | |
| 977 | + */ | |
| 978 | +function bbp_publicize_forum( $forum_id = 0, $current_visibility = '' ) { | |
| 979 | + | |
| 980 | + $forum_id = bbp_get_forum_id( $forum_id ); | |
| 981 | + | |
| 982 | + do_action( 'bbp_publicize_forum', $forum_id ); | |
| 983 | + | |
| 984 | + // Update forum visibility options | |
| 985 | + bbp_update_forum_visibility_options( $forum_id, bbp_get_public_status_id() ); | |
| 986 | + | |
| 938 | 987 | // Only run queries if visibility is changing |
| 939 | 988 | if ( bbp_get_public_status_id() !== $current_visibility ) { |
| 940 | 989 | $bbp_db = bbp_db(); |
| 941 | 990 | $bbp_db->update( $bbp_db->posts, array( 'post_status' => bbp_get_public_status_id() ), array( 'ID' => $forum_id ) ); |
| @@ -961,31 +1010,14 @@ | ||
| 961 | 1010 | $forum_id = bbp_get_forum_id( $forum_id ); |
| 962 | 1011 | |
| 963 | 1012 | do_action( 'bbp_privatize_forum', $forum_id ); |
| 964 | 1013 | |
| 1014 | + // Update forum visibility options | |
| 1015 | + bbp_update_forum_visibility_options( $forum_id, bbp_get_private_status_id() ); | |
| 1016 | + | |
| 965 | 1017 | // Only run queries if visibility is changing |
| 966 | 1018 | if ( bbp_get_private_status_id() !== $current_visibility ) { |
| 967 | 1019 | |
| 968 | - // Get hidden forums | |
| 969 | - $hidden = bbp_get_hidden_forum_ids(); | |
| 970 | - | |
| 971 | - // Find this forum in the array | |
| 972 | - if ( in_array( $forum_id, $hidden, true ) ) { | |
| 973 | - | |
| 974 | - $offset = array_search( $forum_id, $hidden, true ); | |
| 975 | - | |
| 976 | - // Splice around it | |
| 977 | - array_splice( $hidden, $offset, 1 ); | |
| 978 | - | |
| 979 | - // Update hidden forums minus this one | |
| 980 | - update_option( '_bbp_hidden_forums', bbp_get_unique_array_values( $hidden ) ); | |
| 981 | - } | |
| 982 | - | |
| 983 | - // Add to '_bbp_private_forums' site option | |
| 984 | - $private = bbp_get_private_forum_ids(); | |
| 985 | - $private[] = $forum_id; | |
| 986 | - update_option( '_bbp_private_forums', bbp_get_unique_array_values( $private ) ); | |
| 987 | - | |
| 988 | 1020 | // Update forums visibility setting |
| 989 | 1021 | $bbp_db = bbp_db(); |
| 990 | 1022 | $bbp_db->update( $bbp_db->posts, array( 'post_status' => bbp_get_private_status_id() ), array( 'ID' => $forum_id ) ); |
| 991 | 1023 | wp_transition_post_status( bbp_get_private_status_id(), $current_visibility, get_post( $forum_id ) ); |
| @@ -1010,31 +1042,14 @@ | ||
| 1010 | 1042 | $forum_id = bbp_get_forum_id( $forum_id ); |
| 1011 | 1043 | |
| 1012 | 1044 | do_action( 'bbp_hide_forum', $forum_id ); |
| 1013 | 1045 | |
| 1046 | + // Update forum visibility options | |
| 1047 | + bbp_update_forum_visibility_options( $forum_id, bbp_get_hidden_status_id() ); | |
| 1048 | + | |
| 1014 | 1049 | // Only run queries if visibility is changing |
| 1015 | 1050 | if ( bbp_get_hidden_status_id() !== $current_visibility ) { |
| 1016 | 1051 | |
| 1017 | - // Get private forums | |
| 1018 | - $private = bbp_get_private_forum_ids(); | |
| 1019 | - | |
| 1020 | - // Find this forum in the array | |
| 1021 | - if ( in_array( $forum_id, $private, true ) ) { | |
| 1022 | - | |
| 1023 | - $offset = array_search( $forum_id, $private, true ); | |
| 1024 | - | |
| 1025 | - // Splice around it | |
| 1026 | - array_splice( $private, $offset, 1 ); | |
| 1027 | - | |
| 1028 | - // Update private forums minus this one | |
| 1029 | - update_option( '_bbp_private_forums', bbp_get_unique_array_values( $private ) ); | |
| 1030 | - } | |
| 1031 | - | |
| 1032 | - // Add to '_bbp_hidden_forums' site option | |
| 1033 | - $hidden = bbp_get_hidden_forum_ids(); | |
| 1034 | - $hidden[] = $forum_id; | |
| 1035 | - update_option( '_bbp_hidden_forums', bbp_get_unique_array_values( $hidden ) ); | |
| 1036 | - | |
| 1037 | 1052 | // Update forums visibility setting |
| 1038 | 1053 | $bbp_db = bbp_db(); |
| 1039 | 1054 | $bbp_db->update( $bbp_db->posts, array( 'post_status' => bbp_get_hidden_status_id() ), array( 'ID' => $forum_id ) ); |
| 1040 | 1055 | wp_transition_post_status( bbp_get_hidden_status_id(), $current_visibility, get_post( $forum_id ) ); |
| @@ -1154,10 +1169,10 @@ | ||
| 1154 | 1169 | |
| 1155 | 1170 | /** |
| 1156 | 1171 | * Bump the total topic count of a forum |
| 1157 | 1172 | * |
| 1158 | - * @since 2.1.0 bbPress (r3825) | |
| 1159 | - * @since 2.6.17 Use atomic metadata writes and non-negative counts. | |
| 1173 | + * @since 2.1.0 bbPress (r3826) | |
| 1174 | + * @since 2.6.17 bbPress (r7468) Use atomic metadata writes and non-negative counts. | |
| 1160 | 1175 | * |
| 1161 | 1176 | * @param int $forum_id Optional. Forum id. |
| 1162 | 1177 | * @param int $difference Optional. Default 1 |
| 1163 | 1178 | * @param bool $update_ancestors Optional. Default true |
| @@ -1277,10 +1292,10 @@ | ||
| 1277 | 1292 | |
| 1278 | 1293 | /** |
| 1279 | 1294 | * Bump the total topic count of a forum |
| 1280 | 1295 | * |
| 1281 | - * @since 2.1.0 bbPress (r3825) | |
| 1282 | - * @since 2.6.17 Use atomic metadata writes and non-negative counts. | |
| 1296 | + * @since 2.1.0 bbPress (r3826) | |
| 1297 | + * @since 2.6.17 bbPress (r7468) Use atomic metadata writes and non-negative counts. | |
| 1283 | 1298 | * |
| 1284 | 1299 | * @param int $forum_id Optional. Forum id. |
| 1285 | 1300 | * @param int $difference Optional. Default 1 |
| 1286 | 1301 | * @param bool $update_ancestors Optional. Default true |
| @@ -1401,10 +1416,10 @@ | ||
| 1401 | 1416 | |
| 1402 | 1417 | /** |
| 1403 | 1418 | * Bump the total topic count of a forum |
| 1404 | 1419 | * |
| 1405 | - * @since 2.1.0 bbPress (r3825) | |
| 1406 | - * @since 2.6.17 Use atomic metadata writes and non-negative counts. | |
| 1420 | + * @since 2.1.0 bbPress (r3826) | |
| 1421 | + * @since 2.6.17 bbPress (r7468) Use atomic metadata writes and non-negative counts. | |
| 1407 | 1422 | * |
| 1408 | 1423 | * @param int $forum_id Optional. Forum id. |
| 1409 | 1424 | * @param int $difference Optional. Default 1 |
| 1410 | 1425 | * @param bool $update_ancestors Optional. Default true |
| @@ -1461,10 +1476,10 @@ | ||
| 1461 | 1476 | |
| 1462 | 1477 | /** |
| 1463 | 1478 | * Bump the total topic count of a forum |
| 1464 | 1479 | * |
| 1465 | - * @since 2.6.0 bbPress (r6922) | |
| 1466 | - * @since 2.6.17 Use atomic metadata writes and non-negative counts. | |
| 1480 | + * @since 2.6.0 bbPress (r6923) | |
| 1481 | + * @since 2.6.17 bbPress (r7468) Use atomic metadata writes and non-negative counts. | |
| 1467 | 1482 | * |
| 1468 | 1483 | * @param int $forum_id Optional. Forum id. |
| 1469 | 1484 | * @param int $difference Optional. Default 1 |
| 1470 | 1485 | * @param bool $update_ancestors Optional. Default true |
| @@ -1532,9 +1547,9 @@ | ||
| 1532 | 1547 | * Only parent forums are traversed: topics and replies are never ancestors in |
| 1533 | 1548 | * a valid forum hierarchy, even when the metadata key stores their totals. The |
| 1534 | 1549 | * walk stops if a malformed parent relationship leaves the forum post type. |
| 1535 | 1550 | * |
| 1536 | - * @since 2.6.17 | |
| 1551 | + * @since 2.6.17 bbPress (r7468) | |
| 1537 | 1552 | * |
| 1538 | 1553 | * @param int $forum_id Starting forum ID. Its own count is not changed. |
| 1539 | 1554 | * @param string $meta_key Topic or reply total count metadata key. |
| 1540 | 1555 | * @param int $difference Amount to add to the stored value. |
| @@ -1641,9 +1656,9 @@ | ||
| 1641 | 1656 | |
| 1642 | 1657 | /** |
| 1643 | 1658 | * Increase the total hidden reply count of a forum by one. |
| 1644 | 1659 | * |
| 1645 | - * @since 2.6.0 bbPress (r6036) | |
| 1660 | + * @since 2.6.0 bbPress (r6923) | |
| 1646 | 1661 | * |
| 1647 | 1662 | * @param int $forum_id The forum id. |
| 1648 | 1663 | * |
| 1649 | 1664 | * @return void |
| @@ -1673,9 +1688,9 @@ | ||
| 1673 | 1688 | |
| 1674 | 1689 | /** |
| 1675 | 1690 | * Decrease the total hidden reply count of a forum by one. |
| 1676 | 1691 | * |
| 1677 | - * @since 2.6.0 bbPress (r6036) | |
| 1692 | + * @since 2.6.0 bbPress (r6923) | |
| 1678 | 1693 | * |
| 1679 | 1694 | * @param int $forum_id The forum id. |
| 1680 | 1695 | * |
| 1681 | 1696 | * @return void |
| @@ -1735,9 +1750,9 @@ | ||
| 1735 | 1750 | |
| 1736 | 1751 | /** |
| 1737 | 1752 | * Update the forum last topic id |
| 1738 | 1753 | * |
| 1739 | - * @since 2.0.0 bbPress (r2625) | |
| 1754 | + * @since 2.0.0 bbPress (r2627) | |
| 1740 | 1755 | * |
| 1741 | 1756 | * @param int $forum_id Optional. Forum id. |
| 1742 | 1757 | * @param int $topic_id Optional. Topic id. |
| 1743 | 1758 | * @return int Id of the forums most recent topic |
| @@ -1794,9 +1809,9 @@ | ||
| 1794 | 1809 | |
| 1795 | 1810 | /** |
| 1796 | 1811 | * Update the forum last reply id |
| 1797 | 1812 | * |
| 1798 | - * @since 2.0.0 bbPress (r2625) | |
| 1813 | + * @since 2.0.0 bbPress (r2627) | |
| 1799 | 1814 | * |
| 1800 | 1815 | * @param int $forum_id Optional. Forum id. |
| 1801 | 1816 | * @param int $reply_id Optional. Reply id. |
| 1802 | 1817 | * @return int Id of the forums most recent reply |
| @@ -1850,9 +1865,9 @@ | ||
| 1850 | 1865 | |
| 1851 | 1866 | /** |
| 1852 | 1867 | * Update the forum last active post id |
| 1853 | 1868 | * |
| 1854 | - * @since 2.0.0 bbPress (r2860) | |
| 1869 | + * @since 2.0.0 bbPress (r2870) | |
| 1855 | 1870 | * |
| 1856 | 1871 | * @param int $forum_id Optional. Forum id. |
| 1857 | 1872 | * @param int $active_id Optional. Active post id. |
| 1858 | 1873 | * @return int Id of the forums last active post |
| @@ -1908,9 +1923,9 @@ | ||
| 1908 | 1923 | |
| 1909 | 1924 | /** |
| 1910 | 1925 | * Update the forums last active date/time (aka freshness) |
| 1911 | 1926 | * |
| 1912 | - * @since 2.0.0 bbPress (r2680) | |
| 1927 | + * @since 2.0.0 bbPress (r2870) | |
| 1913 | 1928 | * |
| 1914 | 1929 | * @param int $forum_id Optional. Topic id. |
| 1915 | 1930 | * @param string $new_time Optional. New time in mysql format. |
| 1916 | 1931 | * |
| @@ -1935,10 +1950,10 @@ | ||
| 1935 | 1950 | |
| 1936 | 1951 | /** |
| 1937 | 1952 | * Update the forum sub-forum count |
| 1938 | 1953 | * |
| 1939 | - * @since 2.0.0 bbPress (r2625) | |
| 1940 | - * @since 2.6.17 Count supported forum visibilities from the post hierarchy. | |
| 1954 | + * @since 2.0.0 bbPress (r2627) | |
| 1955 | + * @since 2.6.17 bbPress (r7454) Count supported forum visibilities from the post hierarchy. | |
| 1941 | 1956 | * |
| 1942 | 1957 | * @param int $forum_id Optional. Forum ID. |
| 1943 | 1958 | * @param int|bool $subforums Optional. Number of subforums, or false to query. |
| 1944 | 1959 | * @return int|false Number of subforums, or false on query failure. |
| @@ -1977,9 +1992,9 @@ | ||
| 1977 | 1992 | |
| 1978 | 1993 | /** |
| 1979 | 1994 | * Synchronize child-forum metadata after WordPress reparents deleted children. |
| 1980 | 1995 | * |
| 1981 | - * @since 2.6.17 | |
| 1996 | + * @since 2.6.17 bbPress (r7454) | |
| 1982 | 1997 | * |
| 1983 | 1998 | * @param int $forum_id Deleted forum ID. |
| 1984 | 1999 | * @param WP_Post $forum Deleted forum post object. |
| 1985 | 2000 | */ |
| @@ -2004,9 +2019,9 @@ | ||
| 2004 | 2019 | |
| 2005 | 2020 | /** |
| 2006 | 2021 | * Update a parent forum's subforum count after a child is permanently deleted. |
| 2007 | 2022 | * |
| 2008 | - * @since 2.6.17 | |
| 2023 | + * @since 2.6.17 bbPress (r7454) | |
| 2009 | 2024 | * |
| 2010 | 2025 | * @param int $forum_id Forum ID. |
| 2011 | 2026 | * @param WP_Post|bool $forum Optional. Forum post object. |
| 2012 | 2027 | * @return int|false Updated subforum count, or false if there is no parent. |
| @@ -2026,9 +2041,9 @@ | ||
| 2026 | 2041 | |
| 2027 | 2042 | /** |
| 2028 | 2043 | * Update a parent forum's subforum count after a child changes count status. |
| 2029 | 2044 | * |
| 2030 | - * @since 2.6.17 | |
| 2045 | + * @since 2.6.17 bbPress (r7454) | |
| 2031 | 2046 | * |
| 2032 | 2047 | * @param string $new_status New post status. |
| 2033 | 2048 | * @param string $old_status Old post status. |
| 2034 | 2049 | * @param WP_Post $forum Forum post object. |
| @@ -2055,9 +2070,9 @@ | ||
| 2055 | 2070 | |
| 2056 | 2071 | /** |
| 2057 | 2072 | * Update subforum counts after a forum changes parent or post type. |
| 2058 | 2073 | * |
| 2059 | - * @since 2.6.17 | |
| 2074 | + * @since 2.6.17 bbPress (r7454) | |
| 2060 | 2075 | * |
| 2061 | 2076 | * @param int $forum_id Forum ID. |
| 2062 | 2077 | * @param WP_Post $forum_after Forum object following the update. |
| 2063 | 2078 | * @param WP_Post $forum_before Forum object before the update. |
| @@ -2099,9 +2114,9 @@ | ||
| 2099 | 2114 | /** |
| 2100 | 2115 | * Adjust the total topic count of a forum. |
| 2101 | 2116 | * |
| 2102 | 2117 | * @since 2.0.0 bbPress (r2464) |
| 2103 | - * @since 2.6.17 Optionally update ancestor forum totals. | |
| 2118 | + * @since 2.6.17 bbPress (r7468) Optionally update ancestor forum totals. | |
| 2104 | 2119 | * |
| 2105 | 2120 | * @param int $forum_id Optional. Forum id or topic id. It is checked whether it |
| 2106 | 2121 | * is a topic or a forum. If it's a topic, its parent, |
| 2107 | 2122 | * i.e. the forum is automatically retrieved. |
| @@ -2146,11 +2161,11 @@ | ||
| 2146 | 2161 | /** |
| 2147 | 2162 | * Adjust the total hidden topic count of a forum (hidden includes trashed, |
| 2148 | 2163 | * spammed and pending topics). |
| 2149 | 2164 | * |
| 2150 | - * @since 2.0.0 bbPress (r2888) | |
| 2165 | + * @since 2.0.0 bbPress (r3349) | |
| 2151 | 2166 | * @since 2.6.0 bbPress (r5954) Replace direct queries with WP_Query() objects |
| 2152 | - * @since 2.6.17 Optionally update ancestor forum totals. | |
| 2167 | + * @since 2.6.17 bbPress (r7468) Optionally update ancestor forum totals. | |
| 2153 | 2168 | * |
| 2154 | 2169 | * @param int $forum_id Optional. Topic id to update. |
| 2155 | 2170 | * @param int $topic_count Optional. Set the topic count manually. |
| 2156 | 2171 | * @param bool $update_ancestors Optional. Whether to update ancestor totals. |
| @@ -2231,12 +2246,12 @@ | ||
| 2231 | 2246 | |
| 2232 | 2247 | /** |
| 2233 | 2248 | * Adjust the total reply count of a forum. |
| 2234 | 2249 | * |
| 2235 | - * @since 2.0.0 bbPress (r2464) | |
| 2250 | + * @since 2.0.0 bbPress (r2615) | |
| 2236 | 2251 | * @since 2.6.0 bbPress (r5954) Replace direct queries with WP_Query() objects. |
| 2237 | - * @since 2.6.17 Count replies only when their parent topics are public. | |
| 2238 | - * @since 2.6.17 Optionally update ancestor forum totals. | |
| 2252 | + * @since 2.6.17 bbPress (r7468) Count replies only when their parent topics are public. | |
| 2253 | + * @since 2.6.17 bbPress (r7468) Optionally update ancestor forum totals. | |
| 2239 | 2254 | * |
| 2240 | 2255 | * @param int $forum_id Optional. Forum id or topic id. It is checked whether it |
| 2241 | 2256 | * is a topic or a forum. If it's a topic, its parent, |
| 2242 | 2257 | * i.e. the forum is automatically retrieved. |
| @@ -2313,10 +2328,10 @@ | ||
| 2313 | 2328 | |
| 2314 | 2329 | /** |
| 2315 | 2330 | * Adjust the total hidden reply count of a forum. |
| 2316 | 2331 | * |
| 2317 | - * @since 2.6.0 bbPress (r6922) | |
| 2318 | - * @since 2.6.17 Optionally update ancestor forum totals. | |
| 2332 | + * @since 2.6.0 bbPress (r6923) | |
| 2333 | + * @since 2.6.17 bbPress (r7468) Optionally update ancestor forum totals. | |
| 2319 | 2334 | * |
| 2320 | 2335 | * @param int $forum_id Optional. Forum id or topic id. It is checked whether it |
| 2321 | 2336 | * is a topic or a forum. If it's a topic, its parent, |
| 2322 | 2337 | * i.e. the forum is automatically retrieved. |
| @@ -2367,9 +2382,9 @@ | ||
| 2367 | 2382 | * This calls a few internal functions that all run manual queries against the |
| 2368 | 2383 | * database to get their results. As such, this function can be costly to run |
| 2369 | 2384 | * but is necessary to keep everything accurate. |
| 2370 | 2385 | * |
| 2371 | - * @since 2.0.0 bbPress (r2908) | |
| 2386 | + * @since 2.0.0 bbPress (r2907) | |
| 2372 | 2387 | * |
| 2373 | 2388 | * @param array $args Supports these arguments: |
| 2374 | 2389 | * - forum_id: Forum id |
| 2375 | 2390 | * - last_topic_id: Last topic id |
| @@ -2433,9 +2448,9 @@ | ||
| 2433 | 2448 | |
| 2434 | 2449 | /** |
| 2435 | 2450 | * Walk up the forum hierarchy and update parent forums. |
| 2436 | 2451 | * |
| 2437 | - * @since 2.6.17 | |
| 2452 | + * @since 2.6.17 bbPress (r7456) | |
| 2438 | 2453 | * |
| 2439 | 2454 | * @param array $args Parsed arguments from bbp_update_forum(). |
| 2440 | 2455 | * @return false|null False if there is no parent forum, otherwise null. |
| 2441 | 2456 | */ |
| @@ -2466,9 +2481,9 @@ | ||
| 2466 | 2481 | * |
| 2467 | 2482 | * Developers note: these statuses are actually stored as meta data, and |
| 2468 | 2483 | * Visibilities are stored in post_status. |
| 2469 | 2484 | * |
| 2470 | - * @since 2.4.0 bbPress (r5059) | |
| 2485 | + * @since 2.4.0 bbPress (r5060) | |
| 2471 | 2486 | * |
| 2472 | 2487 | * @param int $forum_id Optional. Forum id. |
| 2473 | 2488 | * |
| 2474 | 2489 | * @return array |
| @@ -2488,9 +2503,9 @@ | ||
| 2488 | 2503 | |
| 2489 | 2504 | /** |
| 2490 | 2505 | * Return an associative array of forum types |
| 2491 | 2506 | * |
| 2492 | - * @since 2.4.0 bbPress (r5059) | |
| 2507 | + * @since 2.4.0 bbPress (r5060) | |
| 2493 | 2508 | * |
| 2494 | 2509 | * @param int $forum_id Optional. Forum id. |
| 2495 | 2510 | * |
| 2496 | 2511 | * @return array |
| @@ -2513,9 +2528,9 @@ | ||
| 2513 | 2528 | * |
| 2514 | 2529 | * Developers note: these visibilities are actually stored in post_status, and |
| 2515 | 2530 | * Statuses are stored in meta data. |
| 2516 | 2531 | * |
| 2517 | - * @since 2.4.0 bbPress (r5059) | |
| 2532 | + * @since 2.4.0 bbPress (r5060) | |
| 2518 | 2533 | * |
| 2519 | 2534 | * @param int $forum_id Optional. Forum id. |
| 2520 | 2535 | * |
| 2521 | 2536 | * @return array |
| @@ -2536,9 +2551,9 @@ | ||
| 2536 | 2551 | |
| 2537 | 2552 | /** |
| 2538 | 2553 | * Return array of public forum statuses. |
| 2539 | 2554 | * |
| 2540 | - * @since 2.6.0 bbPress (r6921) | |
| 2555 | + * @since 2.6.0 bbPress (r6922) | |
| 2541 | 2556 | * |
| 2542 | 2557 | * @return array |
| 2543 | 2558 | */ |
| 2544 | 2559 | function bbp_get_public_forum_statuses() { |
| @@ -2552,9 +2567,9 @@ | ||
| 2552 | 2567 | |
| 2553 | 2568 | /** |
| 2554 | 2569 | * Return array of non-public forum statuses. |
| 2555 | 2570 | * |
| 2556 | - * @since 2.6.0 bbPress (r6921) | |
| 2571 | + * @since 2.6.0 bbPress (r6922) | |
| 2557 | 2572 | * |
| 2558 | 2573 | * @return array |
| 2559 | 2574 | */ |
| 2560 | 2575 | function bbp_get_non_public_forum_statuses() { |
| @@ -2569,9 +2584,9 @@ | ||
| 2569 | 2584 | |
| 2570 | 2585 | /** |
| 2571 | 2586 | * Return forum statuses included in forum and subforum counts. |
| 2572 | 2587 | * |
| 2573 | - * @since 2.6.17 | |
| 2588 | + * @since 2.6.17 bbPress (r7454) | |
| 2574 | 2589 | * |
| 2575 | 2590 | * @return array |
| 2576 | 2591 | */ |
| 2577 | 2592 | function bbp_get_countable_forum_statuses() { |
| @@ -2587,9 +2602,9 @@ | ||
| 2587 | 2602 | * Returns the hidden forum ids |
| 2588 | 2603 | * |
| 2589 | 2604 | * Only hidden forum ids are returned. Public and private ids are not. |
| 2590 | 2605 | * |
| 2591 | - * @since 2.0.0 bbPress (r3007) | |
| 2606 | + * @since 2.0.0 bbPress (r3008) | |
| 2592 | 2607 | */ |
| 2593 | 2608 | function bbp_get_hidden_forum_ids() { |
| 2594 | 2609 | $forum_ids = get_option( '_bbp_hidden_forums', array() ); |
| 2595 | 2610 | $forum_ids = ! empty( $forum_ids ) |
| @@ -2604,9 +2619,9 @@ | ||
| 2604 | 2619 | * Returns the private forum ids |
| 2605 | 2620 | * |
| 2606 | 2621 | * Only private forum ids are returned. Public and hidden ids are not. |
| 2607 | 2622 | * |
| 2608 | - * @since 2.0.0 bbPress (r3007) | |
| 2623 | + * @since 2.0.0 bbPress (r3008) | |
| 2609 | 2624 | */ |
| 2610 | 2625 | function bbp_get_private_forum_ids() { |
| 2611 | 2626 | $forum_ids = get_option( '_bbp_private_forums', array() ); |
| 2612 | 2627 | $forum_ids = ! empty( $forum_ids ) |
| @@ -2627,9 +2642,9 @@ | ||
| 2627 | 2642 | * |
| 2628 | 2643 | * If you have a need to filter these results based on your own custom |
| 2629 | 2644 | * engagements API usages, please see: bbp_allow_forums_of_user() |
| 2630 | 2645 | * |
| 2631 | - * @since 2.6.0 bbPress (r6425) | |
| 2646 | + * @since 2.6.0 bbPress (r6426) | |
| 2632 | 2647 | * |
| 2633 | 2648 | * @return array Forum IDs to exclude, or an empty array |
| 2634 | 2649 | */ |
| 2635 | 2650 | function bbp_get_excluded_forum_ids() { |
| @@ -2648,14 +2663,14 @@ | ||
| 2648 | 2663 | $forum_ids = ( ! empty( $private ) || ! empty( $hidden ) ) |
| 2649 | 2664 | ? array_filter( wp_parse_id_list( array_merge( $private, $hidden ) ) ) |
| 2650 | 2665 | : array(); |
| 2651 | 2666 | |
| 2652 | - // Include descendants of private and hidden forums | |
| 2667 | + // Include every descendant, even below a forum with a non-countable status | |
| 2653 | 2668 | $parents = $forum_ids; |
| 2654 | 2669 | while ( ! empty( $parents ) ) { |
| 2655 | 2670 | $parent_id = array_shift( $parents ); |
| 2656 | 2671 | |
| 2657 | - foreach ( bbp_forum_query_subforum_ids( $parent_id ) as $forum_id ) { | |
| 2672 | + foreach ( bbp_forum_query_all_subforum_ids( $parent_id ) as $forum_id ) { | |
| 2658 | 2673 | if ( ! in_array( $forum_id, $forum_ids, true ) ) { |
| 2659 | 2674 | $forum_ids[] = $forum_id; |
| 2660 | 2675 | $parents[] = $forum_id; |
| 2661 | 2676 | } |
| @@ -2669,12 +2684,49 @@ | ||
| 2669 | 2684 | return (array) apply_filters( 'bbp_get_excluded_forum_ids', $forum_ids, $private, $hidden ); |
| 2670 | 2685 | } |
| 2671 | 2686 | |
| 2672 | 2687 | /** |
| 2688 | + * Return all direct child forum IDs for visibility checks. | |
| 2689 | + * | |
| 2690 | + * A non-countable forum can still have public descendants. Traversing only | |
| 2691 | + * countable children would expose those descendants in public queries. | |
| 2692 | + * | |
| 2693 | + * @since 2.6.19 bbPress (r7693) | |
| 2694 | + * | |
| 2695 | + * @param int $forum_id Parent forum ID. | |
| 2696 | + * @return int[] Child forum IDs. | |
| 2697 | + */ | |
| 2698 | +function bbp_forum_query_all_subforum_ids( $forum_id ) { | |
| 2699 | + $forum_id = bbp_get_forum_id( $forum_id ); | |
| 2700 | + | |
| 2701 | + if ( empty( $forum_id ) ) { | |
| 2702 | + return array(); | |
| 2703 | + } | |
| 2704 | + | |
| 2705 | + $key = md5( serialize( array( $forum_id, bbp_get_forum_post_type(), 'all' ) ) ); | |
| 2706 | + $cache_key = "bbp_child_ids:{$key}:" . wp_cache_get_last_changed( 'bbpress_posts' ); | |
| 2707 | + $forum_ids = wp_cache_get( $cache_key, 'bbpress_posts' ); | |
| 2708 | + | |
| 2709 | + if ( false === $forum_ids ) { | |
| 2710 | + $bbp_db = bbp_db(); | |
| 2711 | + $query = $bbp_db->prepare( | |
| 2712 | + "SELECT ID FROM {$bbp_db->posts} WHERE post_parent = %d AND post_type = %s ORDER BY ID DESC", | |
| 2713 | + $forum_id, | |
| 2714 | + bbp_get_forum_post_type() | |
| 2715 | + ); | |
| 2716 | + $forum_ids = (array) $bbp_db->get_col( $query ); | |
| 2717 | + | |
| 2718 | + wp_cache_set( $cache_key, $forum_ids, 'bbpress_posts' ); | |
| 2719 | + } | |
| 2720 | + | |
| 2721 | + return wp_parse_id_list( $forum_ids ); | |
| 2722 | +} | |
| 2723 | + | |
| 2724 | +/** | |
| 2673 | 2725 | * Returns a meta_query that either includes or excludes hidden forum IDs |
| 2674 | 2726 | * from a query. |
| 2675 | 2727 | * |
| 2676 | - * @since 2.0.0 bbPress (r3291) | |
| 2728 | + * @since 2.0.0 bbPress (r3085) | |
| 2677 | 2729 | * |
| 2678 | 2730 | * @param string Optional. The type of value to return. (string|array|meta_query) |
| 2679 | 2731 | */ |
| 2680 | 2732 | function bbp_exclude_forum_ids( $type = 'string' ) { |
| @@ -2725,9 +2777,10 @@ | ||
| 2725 | 2777 | * Doing it with an action allows us to trap all WP_Query's rather than needing |
| 2726 | 2778 | * to hardcode this logic into each query. It also protects forum content for |
| 2727 | 2779 | * plugins that might be doing their own queries. |
| 2728 | 2780 | * |
| 2729 | - * @since 2.0.0 bbPress (r3291) | |
| 2781 | + * @since 2.3.0 bbPress (r4808) | |
| 2782 | + * @since 2.6.19 bbPress (r7692) Exclude restricted forum IDs from post__in queries. | |
| 2730 | 2783 | * |
| 2731 | 2784 | * @param WP_Query $posts_query |
| 2732 | 2785 | * |
| 2733 | 2786 | * @return WP_Query |
| @@ -2743,10 +2796,10 @@ | ||
| 2743 | 2796 | if ( ! is_object( $posts_query ) || ! is_a( $posts_query, 'WP_Query' ) ) { |
| 2744 | 2797 | return; |
| 2745 | 2798 | } |
| 2746 | 2799 | |
| 2747 | - // Bail to prevent unintended wp-admin post_row overrides | |
| 2748 | - if ( is_admin() && isset( $_REQUEST['post_status'] ) ) { | |
| 2800 | + // Preserve the main post list query without exempting admin-ajax queries | |
| 2801 | + if ( is_admin() && ! wp_doing_ajax() && isset( $_REQUEST['post_status'] ) && isset( $GLOBALS['pagenow'] ) && ( 'edit.php' === $GLOBALS['pagenow'] ) && $posts_query->is_main_query() && current_user_can( 'moderate' ) ) { | |
| 2749 | 2802 | return; |
| 2750 | 2803 | } |
| 2751 | 2804 | |
| 2752 | 2805 | // Get the raw query post types. |
| @@ -2848,8 +2901,15 @@ | ||
| 2848 | 2901 | $posts_query->set( 'p', 0 ); |
| 2849 | 2902 | $posts_query->set( 'post__in', array( 0 ) ); |
| 2850 | 2903 | } |
| 2851 | 2904 | |
| 2905 | + // WordPress ignores post__not_in when post__in has IDs. | |
| 2906 | + $post_in = wp_parse_id_list( $posts_query->get( 'post__in' ) ); | |
| 2907 | + if ( ! empty( $post_in ) ) { | |
| 2908 | + $post_in = array_values( array_diff( $post_in, $forum_ids ) ); | |
| 2909 | + $posts_query->set( 'post__in', ! empty( $post_in ) ? $post_in : array( 0 ) ); | |
| 2910 | + } | |
| 2911 | + | |
| 2852 | 2912 | // Get any existing not-in queries |
| 2853 | 2913 | $not_in = (array) $posts_query->get( 'post__not_in', array() ); |
| 2854 | 2914 | |
| 2855 | 2915 | // Add our not-in to existing |
| @@ -2884,10 +2944,18 @@ | ||
| 2884 | 2944 | |
| 2885 | 2945 | // Get any existing meta queries |
| 2886 | 2946 | $meta_query = (array) $posts_query->get( 'meta_query', array() ); |
| 2887 | 2947 | |
| 2888 | - // Add our meta query to existing | |
| 2889 | - $meta_query[] = $forum_meta_query; | |
| 2948 | + // Keep the exclusion required when existing clauses use OR | |
| 2949 | + if ( isset( $meta_query['relation'] ) && ( 'OR' === strtoupper( $meta_query['relation'] ) ) ) { | |
| 2950 | + $meta_query = array( | |
| 2951 | + 'relation' => 'AND', | |
| 2952 | + $meta_query, | |
| 2953 | + $forum_meta_query | |
| 2954 | + ); | |
| 2955 | + } else { | |
| 2956 | + $meta_query[] = $forum_meta_query; | |
| 2957 | + } | |
| 2890 | 2958 | |
| 2891 | 2959 | // Set the new meta_query val |
| 2892 | 2960 | $posts_query->set( 'meta_query', $meta_query ); |
| 2893 | 2961 | } |
| @@ -2906,9 +2974,9 @@ | ||
| 2906 | 2974 | * Queries with `suppress_filters` enabled are handled conservatively in |
| 2907 | 2975 | * bbp_pre_get_posts_normalize_forum_visibility(), because this filter will not |
| 2908 | 2976 | * run for those queries. |
| 2909 | 2977 | * |
| 2910 | - * @since 2.6.15 bbPress | |
| 2978 | + * @since 2.6.15 bbPress (r7414) | |
| 2911 | 2979 | * |
| 2912 | 2980 | * @param string $where SQL WHERE clause. |
| 2913 | 2981 | * @param WP_Query $posts_query WordPress posts query. |
| 2914 | 2982 | * @return string SQL WHERE clause. |
| @@ -2987,9 +3055,9 @@ | ||
| 2987 | 3055 | |
| 2988 | 3056 | /** |
| 2989 | 3057 | * Filters the forum visibility SQL appended to mixed post-type queries. |
| 2990 | 3058 | * |
| 2991 | - * @since 2.6.15 bbPress | |
| 3059 | + * @since 2.6.15 bbPress (r7414) | |
| 2992 | 3060 | * |
| 2993 | 3061 | * @param string $visibility_where Forum visibility SQL clause. |
| 2994 | 3062 | * @param WP_Query $posts_query WordPress posts query. |
| 2995 | 3063 | * @param string[] $post_types bbPress post types protected by the clause. |
| @@ -3011,9 +3079,9 @@ | ||
| 3011 | 3079 | * Returns the forum's topic ids |
| 3012 | 3080 | * |
| 3013 | 3081 | * Only topics with published and closed statuses are returned |
| 3014 | 3082 | * |
| 3015 | - * @since 2.0.0 bbPress (r2908) | |
| 3083 | + * @since 2.0.0 bbPress (r2895) | |
| 3016 | 3084 | * |
| 3017 | 3085 | * @param int $forum_id Forum id |
| 3018 | 3086 | */ |
| 3019 | 3087 | function bbp_forum_query_topic_ids( $forum_id ) { |
| @@ -3027,10 +3095,10 @@ | ||
| 3027 | 3095 | * Returns the forum's subforum ids. |
| 3028 | 3096 | * |
| 3029 | 3097 | * Only forums with countable statuses are returned. |
| 3030 | 3098 | * |
| 3031 | - * @since 2.0.0 bbPress (r2908) | |
| 3032 | - * @since 2.6.17 Restrict results to countable statuses instead of using | |
| 3099 | + * @since 2.0.0 bbPress (r2895) | |
| 3100 | + * @since 2.6.17 bbPress (r7468) Restrict results to countable statuses instead of using | |
| 3033 | 3101 | * bbp_get_all_child_ids(). |
| 3034 | 3102 | * |
| 3035 | 3103 | * @param int $forum_id Forum id. |
| 3036 | 3104 | */ |
| @@ -3074,9 +3142,9 @@ | ||
| 3074 | 3142 | |
| 3075 | 3143 | /** |
| 3076 | 3144 | * Returns the forum's last reply id |
| 3077 | 3145 | * |
| 3078 | - * @since 2.0.0 bbPress (r2908) | |
| 3146 | + * @since 2.0.0 bbPress (r2895) | |
| 3079 | 3147 | * @since 2.6.0 bbPress (r5954) Replace direct queries with WP_Query() objects |
| 3080 | 3148 | * |
| 3081 | 3149 | * @param int $forum_id Forum id. |
| 3082 | 3150 | * @param int $topic_ids Optional. Topic ids. |
| @@ -3125,9 +3193,9 @@ | ||
| 3125 | 3193 | /** |
| 3126 | 3194 | * Check if it's a hidden forum or a topic or reply of a hidden forum and if |
| 3127 | 3195 | * the user can't view it, then sets a 404 |
| 3128 | 3196 | * |
| 3129 | - * @since 2.0.0 bbPress (r2996) | |
| 3197 | + * @since 2.0.0 bbPress (r3430) | |
| 3130 | 3198 | */ |
| 3131 | 3199 | function bbp_forum_enforce_hidden() { |
| 3132 | 3200 | |
| 3133 | 3201 | // Bail if not viewing a single item or if user has caps |
| @@ -3170,9 +3238,9 @@ | ||
| 3170 | 3238 | /** |
| 3171 | 3239 | * Check if it's a private forum or a topic or reply of a private forum and if |
| 3172 | 3240 | * the user can't view it, then sets a 404 |
| 3173 | 3241 | * |
| 3174 | - * @since 2.0.0 bbPress (r2996) | |
| 3242 | + * @since 2.0.0 bbPress (r3430) | |
| 3175 | 3243 | */ |
| 3176 | 3244 | function bbp_forum_enforce_private() { |
| 3177 | 3245 | |
| 3178 | 3246 | // Bail if not viewing a single item or if user has caps |
| @@ -3234,9 +3302,9 @@ | ||
| 3234 | 3302 | |
| 3235 | 3303 | /** |
| 3236 | 3304 | * Delete all topics (and their replies) for a specific forum ID |
| 3237 | 3305 | * |
| 3238 | - * @since 2.1.0 bbPress (r3668) | |
| 3306 | + * @since 2.1.0 bbPress (r3669) | |
| 3239 | 3307 | * |
| 3240 | 3308 | * @param int $forum_id |
| 3241 | 3309 | * @return If forum is not valid |
| 3242 | 3310 | */ |
| @@ -3285,9 +3353,9 @@ | ||
| 3285 | 3353 | |
| 3286 | 3354 | /** |
| 3287 | 3355 | * Trash all topics inside a forum |
| 3288 | 3356 | * |
| 3289 | - * @since 2.1.0 bbPress (r3668) | |
| 3357 | + * @since 2.1.0 bbPress (r3669) | |
| 3290 | 3358 | * |
| 3291 | 3359 | * @param int $forum_id |
| 3292 | 3360 | * @return If forum is not valid |
| 3293 | 3361 | */ |
| @@ -3353,9 +3421,9 @@ | ||
| 3353 | 3421 | |
| 3354 | 3422 | /** |
| 3355 | 3423 | * Untrash all topics inside a forum |
| 3356 | 3424 | * |
| 3357 | - * @since 2.1.0 bbPress (r3668) | |
| 3425 | + * @since 2.1.0 bbPress (r3669) | |
| 3358 | 3426 | * |
| 3359 | 3427 | * @param int $forum_id |
| 3360 | 3428 | * @return If forum is not valid |
| 3361 | 3429 | */ |
| @@ -3394,9 +3462,9 @@ | ||
| 3394 | 3462 | * This function is supplemental to the actual forum deletion which is |
| 3395 | 3463 | * handled by WordPress core API functions. It is used to clean up after |
| 3396 | 3464 | * a forum that is being deleted. |
| 3397 | 3465 | * |
| 3398 | - * @since 2.1.0 bbPress (r3668) | |
| 3466 | + * @since 2.1.0 bbPress (r3669) | |
| 3399 | 3467 | */ |
| 3400 | 3468 | function bbp_delete_forum( $forum_id = 0 ) { |
| 3401 | 3469 | $forum_id = bbp_get_forum_id( $forum_id ); |
| 3402 | 3470 | |
| @@ -3413,9 +3481,9 @@ | ||
| 3413 | 3481 | * This function is supplemental to the actual forum being trashed which is |
| 3414 | 3482 | * handled by WordPress core API functions. It is used to clean up after |
| 3415 | 3483 | * a forum that is being trashed. |
| 3416 | 3484 | * |
| 3417 | - * @since 2.1.0 bbPress (r3668) | |
| 3485 | + * @since 2.1.0 bbPress (r3669) | |
| 3418 | 3486 | */ |
| 3419 | 3487 | function bbp_trash_forum( $forum_id = 0 ) { |
| 3420 | 3488 | $forum_id = bbp_get_forum_id( $forum_id ); |
| 3421 | 3489 | |
| @@ -3428,9 +3496,9 @@ | ||
| 3428 | 3496 | |
| 3429 | 3497 | /** |
| 3430 | 3498 | * Called before untrashing a forum |
| 3431 | 3499 | * |
| 3432 | - * @since 2.1.0 bbPress (r3668) | |
| 3500 | + * @since 2.1.0 bbPress (r3669) | |
| 3433 | 3501 | */ |
| 3434 | 3502 | function bbp_untrash_forum( $forum_id = 0 ) { |
| 3435 | 3503 | $forum_id = bbp_get_forum_id( $forum_id ); |
| 3436 | 3504 | |
| @@ -3448,11 +3516,11 @@ | ||
| 3448 | 3516 | * |
| 3449 | 3517 | * Try not to use this action. All meta & taxonomy terms have already been |
| 3450 | 3518 | * deleted, making them impossible to use. |
| 3451 | 3519 | * |
| 3452 | - * @since 2.1.0 bbPress (r3668) | |
| 3453 | - * @since 2.6.0 bbPress (r6526) Not recommend for usage | |
| 3454 | - * @since 2.6.17 Added the `$forum` parameter and passed it to the action. | |
| 3520 | + * @since 2.1.0 bbPress (r3669) | |
| 3521 | + * @since 2.6.0 bbPress (r6529) Not recommend for usage | |
| 3522 | + * @since 2.6.17 bbPress (r7454) Added the `$forum` parameter and passed it to the action. | |
| 3455 | 3523 | * |
| 3456 | 3524 | * @param int $forum_id Forum ID. |
| 3457 | 3525 | * @param WP_Post|bool $forum Optional. Deleted forum post object. |
| 3458 | 3526 | * @return false|null False if the post is not a forum, otherwise null. |
| @@ -3472,9 +3540,9 @@ | ||
| 3472 | 3540 | |
| 3473 | 3541 | /** |
| 3474 | 3542 | * Called after trashing a forum |
| 3475 | 3543 | * |
| 3476 | - * @since 2.1.0 bbPress (r3668) | |
| 3544 | + * @since 2.1.0 bbPress (r3669) | |
| 3477 | 3545 | */ |
| 3478 | 3546 | function bbp_trashed_forum( $forum_id = 0 ) { |
| 3479 | 3547 | $forum_id = bbp_get_forum_id( $forum_id ); |
| 3480 | 3548 | |
| @@ -3487,9 +3555,9 @@ | ||
| 3487 | 3555 | |
| 3488 | 3556 | /** |
| 3489 | 3557 | * Called after untrashing a forum |
| 3490 | 3558 | * |
| 3491 | - * @since 2.1.0 bbPress (r3668) | |
| 3559 | + * @since 2.1.0 bbPress (r3669) | |
| 3492 | 3560 | */ |
| 3493 | 3561 | function bbp_untrashed_forum( $forum_id = 0 ) { |
| 3494 | 3562 | $forum_id = bbp_get_forum_id( $forum_id ); |
| 3495 | 3563 | |