Changeset 7380 for trunk/src/includes/forums/functions.php
- Timestamp:
- 12/05/2025 02:27:53 AM (6 months ago)
- File:
-
- 1 edited
-
trunk/src/includes/forums/functions.php (modified) (66 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/includes/forums/functions.php
r7379 r7380 19 19 * @since 2.0.0 bbPress (r3349) 20 20 * 21 * @param array $forum_data Forum post data 22 * @param array $forum_meta Forum meta data 21 * @param array $forum_data Forum post data. 22 * @param array $forum_meta Forum meta data. 23 * 24 * @return int|false Forum ID on success, false on failure. 23 25 */ 24 26 function bbp_insert_forum( $forum_data = array(), $forum_meta = array() ) { … … 121 123 122 124 /** 123 * Handles the front end forum submission 124 * 125 * @param string $action The requested action to compare this function to 125 * Handles the front end forum submission. 126 * 127 * @param string $action The requested action to compare this function to. 126 128 */ 127 129 function bbp_new_forum_handler( $action = '' ) { … … 387 389 388 390 /** 389 * Handles the front end edit forum submission 390 * 391 * @param string $action The requested action to compare this function to 391 * Handles the front end edit forum submission. 392 * 393 * @param string $action The requested action to compare this function to. 392 394 */ 393 395 function bbp_edit_forum_handler( $action = '' ) { … … 642 644 643 645 /** 644 * Handle the saving of core forum metadata (Status, Visibility, and Type) 646 * Handle the saving of core forum metadata (Status, Visibility, and Type). 645 647 * 646 648 * @since 2.1.0 bbPress (r3678) 647 649 * 648 * @param int $forum_id 649 * @return If forum ID is empty 650 * @param int $forum_id. 651 * @return If forum ID is empty. 650 652 */ 651 653 function bbp_save_forum_extras( $forum_id = 0 ) { … … 714 716 715 717 /** 716 * Allow custom forum visibility save actions 718 * Allow custom forum visibility save actions. 717 719 * 718 720 * @since 2.6.0 bbPress (r5855) 719 721 * 720 * @param int $forum_id The forum ID 721 * @param string $old_visibility The current forum visibility 722 * @param string $new_visibility The new forum visibility 722 * @param int $forum_id The forum ID. 723 * @param string $old_visibility The current forum visibility. 724 * @param string $new_visibility The new forum visibility. 723 725 */ 724 726 do_action( 'bbp_update_forum_visibility', $forum_id, $old_visibility, $new_visibility ); … … 757 759 758 760 /** 759 * Closes a forum 761 * Closes a forum. 760 762 * 761 763 * @since 2.0.0 bbPress (r2746) 762 764 * 763 * @param int $forum_id forum id 764 * @return mixed False or {@link WP_Error} on failure, forum id on success 765 * @param int $forum_id forum id. 766 * @return mixed False or {@link WP_Error} on failure, forum id on success. 765 767 */ 766 768 function bbp_close_forum( $forum_id = 0 ) { … … 778 780 779 781 /** 780 * Opens a forum 782 * Opens a forum. 781 783 * 782 784 * @since 2.0.0 bbPress (r2746) 783 785 * 784 * @param int $forum_id forum id 785 * @return mixed False or {@link WP_Error} on failure, forum id on success 786 * @param int $forum_id forum id. 787 * @return mixed False or {@link WP_Error} on failure, forum id on success. 786 788 */ 787 789 function bbp_open_forum( $forum_id = 0 ) { … … 801 803 802 804 /** 803 * Make the forum a category 805 * Make the forum a category. 804 806 * 805 807 * @since 2.0.0 bbPress (r2746) 806 808 * 807 * @param int $forum_id Optional. Forum id 808 * @return bool False on failure, true on success 809 * @param int $forum_id Optional. Forum id. 810 * @return bool False on failure, true on success. 809 811 */ 810 812 function bbp_categorize_forum( $forum_id = 0 ) { … … 822 824 823 825 /** 824 * Remove the category status from a forum 826 * Remove the category status from a forum. 825 827 * 826 828 * @since 2.0.0 bbPress (r2746) 827 829 * 828 * @param int $forum_id Optional. Forum id 829 * @return bool False on failure, true on success 830 * @param int $forum_id Optional. Forum id. 831 * @return bool False on failure, true on success. 830 832 */ 831 833 function bbp_normalize_forum( $forum_id = 0 ) { … … 845 847 846 848 /** 847 * Mark the forum as public 849 * Mark the forum as public. 848 850 * 849 851 * @since 2.0.0 bbPress (r2746) 850 852 * 851 * @param int $forum_id Optional. Forum id 852 * @return bool False on failure, true on success 853 * @param int $forum_id Optional. Forum id. 854 * @return bool False on failure, true on success. 853 855 */ 854 856 function bbp_publicize_forum( $forum_id = 0, $current_visibility = '' ) { … … 902 904 903 905 /** 904 * Mark the forum as private 906 * Mark the forum as private. 905 907 * 906 908 * @since 2.0.0 bbPress (r2746) 907 909 * 908 * @param int $forum_id Optional. Forum id 909 * @return bool False on failure, true on success 910 * @param int $forum_id Optional. Forum id. 911 * @return bool False on failure, true on success. 910 912 */ 911 913 function bbp_privatize_forum( $forum_id = 0, $current_visibility = '' ) { … … 951 953 952 954 /** 953 * Mark the forum as hidden 955 * Mark the forum as hidden. 954 956 * 955 957 * @since 2.0.0 bbPress (r2996) 956 958 * 957 * @param int $forum_id Optional. Forum id 958 * @return bool False on failure, true on success 959 * @param int $forum_id Optional. Forum id. 960 * @return bool False on failure, true on success. 959 961 */ 960 962 function bbp_hide_forum( $forum_id = 0, $current_visibility = '' ) { … … 1000 1002 1001 1003 /** 1002 * Re caches the private and hidden forums1004 * Re-caches the private and hidden forums. 1003 1005 * 1004 1006 * @since 2.4.0 bbPress (r5017) 1005 1007 * 1006 * @return array An array of the status code and the message 1008 * @return array An array of the status code and the message. 1007 1009 */ 1008 1010 function bbp_repair_forum_visibility() { … … 1080 1082 1081 1083 /** 1082 * Remove a deleted forum from all user subscriptions 1084 * Remove a deleted forum from all user subscriptions. 1083 1085 * 1084 1086 * @since 2.5.0 bbPress (r5156) 1085 1087 * 1086 * @param int $forum_id Get the forum ID to remove 1088 * @param int $forum_id Get the forum ID to remove. 1087 1089 */ 1088 1090 function bbp_remove_forum_from_all_subscriptions( $forum_id = 0 ) { … … 1106 1108 1107 1109 /** 1108 * Bump the total topic count of a forum 1110 * Bump the total topic count of a forum. 1109 1111 * 1110 1112 * @since 2.1.0 bbPress (r3825) … … 1170 1172 * 1171 1173 * @param int $forum_id The forum id. 1172 * @return void1173 1174 */ 1174 1175 function bbp_increase_forum_topic_count( $forum_id = 0 ) { … … 1201 1202 * 1202 1203 * @param int $forum_id The forum id. 1203 *1204 * @return void1205 1204 */ 1206 1205 function bbp_decrease_forum_topic_count( $forum_id = 0 ) { … … 1228 1227 1229 1228 /** 1230 * Bump the total topic count of a forum 1229 * Bump the total topic count of a forum. 1231 1230 * 1232 1231 * @since 2.1.0 bbPress (r3825) … … 1292 1291 * 1293 1292 * @param int $forum_id The forum id. 1294 *1295 * @return void1296 1293 */ 1297 1294 function bbp_increase_forum_topic_count_hidden( $forum_id = 0 ) { … … 1324 1321 * 1325 1322 * @param int $forum_id The forum id. 1326 *1327 * @return void1328 1323 */ 1329 1324 function bbp_decrease_forum_topic_count_hidden( $forum_id = 0 ) { … … 1351 1346 1352 1347 /** 1353 * Bump the total topic count of a forum 1348 * Bump the total topic count of a forum. 1354 1349 * 1355 1350 * @since 2.1.0 bbPress (r3825) 1356 1351 * 1357 1352 * @param int $forum_id Optional. Forum id. 1358 * @param int $difference Optional. Default 1 1359 * @param bool $update_ancestors Optional. Default true 1353 * @param int $difference Optional. Default 1. 1354 * @param bool $update_ancestors Optional. Default true. 1360 1355 * 1361 1356 * @return int Forum topic count … … 1410 1405 1411 1406 /** 1412 * Bump the total topic count of a forum 1407 * Bump the total topic count of a forum. 1413 1408 * 1414 1409 * @since 2.6.0 bbPress (r6922) 1415 1410 * 1416 1411 * @param int $forum_id Optional. Forum id. 1417 * @param int $difference Optional. Default 1 1418 * @param bool $update_ancestors Optional. Default true 1412 * @param int $difference Optional. Default 1. 1413 * @param bool $update_ancestors Optional. Default true. 1419 1414 * 1420 1415 * @return int Forum topic count … … 1474 1469 * 1475 1470 * @param int $forum_id The forum id. 1476 *1477 * @return void1478 1471 */ 1479 1472 function bbp_increase_forum_reply_count( $forum_id = 0 ) { … … 1506 1499 * 1507 1500 * @param int $forum_id The forum id. 1508 *1509 * @return void1510 1501 */ 1511 1502 function bbp_decrease_forum_reply_count( $forum_id = 0 ) { … … 1538 1529 * 1539 1530 * @param int $forum_id The forum id. 1540 *1541 * @return void1542 1531 */ 1543 1532 function bbp_increase_forum_reply_count_hidden( $forum_id = 0 ) { … … 1570 1559 * 1571 1560 * @param int $forum_id The forum id. 1572 *1573 * @return void1574 1561 */ 1575 1562 function bbp_decrease_forum_reply_count_hidden( $forum_id = 0 ) { … … 1602 1589 * 1603 1590 * @param int $topic_id The topic id. 1604 *1605 * @return void1606 1591 */ 1607 1592 function bbp_approved_unapproved_topic_update_forum_reply_count( $topic_id = 0 ) { … … 1627 1612 1628 1613 /** 1629 * Update the forum last topic id 1614 * Update the forum last topic id. 1630 1615 * 1631 1616 * @since 2.0.0 bbPress (r2625) … … 1633 1618 * @param int $forum_id Optional. Forum id. 1634 1619 * @param int $topic_id Optional. Topic id. 1635 * @return int Id of the forums most recent topic 1620 * @return int Id of the forums most recent topic. 1636 1621 */ 1637 1622 function bbp_update_forum_last_topic_id( $forum_id = 0, $topic_id = 0 ) { … … 1686 1671 1687 1672 /** 1688 * Update the forum last reply id 1673 * Update the forum last reply id. 1689 1674 * 1690 1675 * @since 2.0.0 bbPress (r2625) … … 1692 1677 * @param int $forum_id Optional. Forum id. 1693 1678 * @param int $reply_id Optional. Reply id. 1694 * @return int Id of the forums most recent reply 1679 * @return int Id of the forums most recent reply. 1695 1680 */ 1696 1681 function bbp_update_forum_last_reply_id( $forum_id = 0, $reply_id = 0 ) { … … 1742 1727 1743 1728 /** 1744 * Update the forum last active post id 1729 * Update the forum last active post id. 1745 1730 * 1746 1731 * @since 2.0.0 bbPress (r2860) … … 1748 1733 * @param int $forum_id Optional. Forum id. 1749 1734 * @param int $active_id Optional. Active post id. 1750 * @return int Id of the forums last active post 1735 * @return int Id of the forums last active post. 1751 1736 */ 1752 1737 function bbp_update_forum_last_active_id( $forum_id = 0, $active_id = 0 ) { … … 1800 1785 1801 1786 /** 1802 * Update the forums last active date/time (aka freshness) 1787 * Update the forums last active date/time (aka freshness). 1803 1788 * 1804 1789 * @since 2.0.0 bbPress (r2680) … … 1807 1792 * @param string $new_time Optional. New time in mysql format. 1808 1793 * 1809 * @return string MySQL timestamp of last active topic or reply 1794 * @return string MySQL timestamp of last active topic or reply. 1810 1795 */ 1811 1796 function bbp_update_forum_last_active_time( $forum_id = 0, $new_time = '' ) { … … 1827 1812 1828 1813 /** 1829 * Update the forum sub-forum count 1814 * Update the forum sub-forum count. 1830 1815 * 1831 1816 * @since 2.0.0 bbPress (r2625) 1832 1817 * 1833 * @param int $forum_id Optional. Forum id 1834 * @param int $subforums Optional. Number of subforums 1835 * @return bool True on success, false on failure 1818 * @param int $forum_id Optional. Forum id. 1819 * @param int $subforums Optional. Number of subforums. 1820 * @return bool True on success, false on failure. 1836 1821 */ 1837 1822 function bbp_update_forum_subforum_count( $forum_id = 0, $subforums = false ) { … … 1850 1835 1851 1836 /** 1852 * Adjust the total topic count of a forum 1837 * Adjust the total topic count of a forum. 1853 1838 * 1854 1839 * @since 2.0.0 bbPress (r2464) … … 1857 1842 * is a topic or a forum. If it's a topic, its parent, 1858 1843 * i.e. the forum is automatically retrieved. 1859 * @param bool $total_count Optional. To return the total count or normal count ?1860 * @return int Forum topic count 1844 * @param bool $total_count Optional. To return the total count or normal count. 1845 * @return int Forum topic count. 1861 1846 */ 1862 1847 function bbp_update_forum_topic_count( $forum_id = 0 ) { … … 1888 1873 /** 1889 1874 * Adjust the total hidden topic count of a forum (hidden includes trashed, 1890 * spammed and pending topics) 1875 * spammed and pending topics). 1891 1876 * 1892 1877 * @since 2.0.0 bbPress (r2888) … … 1896 1881 * @param int $topic_count Optional. Set the topic count manually. 1897 1882 * 1898 * @return int Topic hidden topic count 1883 * @return int Topic hidden topic count. 1899 1884 */ 1900 1885 function bbp_update_forum_topic_count_hidden( $forum_id = 0, $topic_count = false ) { … … 1949 1934 1950 1935 /** 1951 * Adjust the total reply count of a forum 1936 * Adjust the total reply count of a forum. 1952 1937 * 1953 1938 * @since 2.0.0 bbPress (r2464) 1954 * @since 2.6.0 bbPress (r5954) Replace direct queries with WP_Query() objects 1939 * @since 2.6.0 bbPress (r5954) Replace direct queries with WP_Query() objects. 1955 1940 * 1956 1941 * @param int $forum_id Optional. Forum id or topic id. It is checked whether it … … 1958 1943 * i.e. the forum is automatically retrieved. 1959 1944 * 1960 * @return int Forum reply count 1945 * @return int Forum reply count. 1961 1946 */ 1962 1947 function bbp_update_forum_reply_count( $forum_id = 0 ) { … … 1990 1975 1991 1976 /** 1992 * Adjust the total hidden reply count of a forum 1977 * Adjust the total hidden reply count of a forum. 1993 1978 * 1994 1979 * @since 2.6.0 bbPress (r6922) … … 1998 1983 * i.e. the forum is automatically retrieved. 1999 1984 * 2000 * @return int Forum reply count 1985 * @return int Forum reply count. 2001 1986 */ 2002 1987 function bbp_update_forum_reply_count_hidden( $forum_id = 0 ) { … … 2109 2094 2110 2095 /** 2111 * Return an associative array of available topic statuses 2096 * Return an associative array of available topic statuses. 2112 2097 * 2113 2098 * Developers note: these statuses are actually stored as meta data, and … … 2116 2101 * @since 2.4.0 bbPress (r5059) 2117 2102 * 2118 * @param int $forum_id Optional. Forum id.2103 * @param int $forum_id Optional. Forum id. 2119 2104 * 2120 2105 * @return array … … 2134 2119 2135 2120 /** 2136 * Return an associative array of forum type s2121 * Return an associative array of forum type. 2137 2122 * 2138 2123 * @since 2.4.0 bbPress (r5059) 2139 2124 * 2140 * @param int $forum_id Optional. Forum id.2125 * @param int $forum_id Optional. Forum id. 2141 2126 * 2142 2127 * @return array … … 2163 2148 * @since 2.4.0 bbPress (r5059) 2164 2149 * 2165 * @param int $forum_id Optional. Forum id.2150 * @param int $forum_id Optional. Forum id. 2166 2151 * 2167 2152 * @return array … … 2217 2202 2218 2203 /** 2219 * Returns the hidden forum ids 2204 * Returns the hidden forum ids. 2220 2205 * 2221 2206 * Only hidden forum ids are returned. Public and private ids are not. … … 2234 2219 2235 2220 /** 2236 * Returns the private forum ids 2221 * Returns the private forum ids. 2237 2222 * 2238 2223 * Only private forum ids are returned. Public and hidden ids are not. … … 2256 2241 * @since 2.6.0 bbPress (r6425) 2257 2242 * 2258 * @return array Forum IDs to exclude, or an empty array 2243 * @return array Forum IDs to exclude, or an empty array. 2259 2244 */ 2260 2245 function bbp_get_excluded_forum_ids() { … … 2285 2270 * @since 2.0.0 bbPress (r3291) 2286 2271 * 2287 * @param string Optional. The type of value to return . (string|array|meta_query)2272 * @param string Optional. The type of value to return (string|array|meta_query). 2288 2273 */ 2289 2274 function bbp_exclude_forum_ids( $type = 'string' ) { … … 2421 2406 2422 2407 /** 2423 * Returns the forum's topic ids 2424 * 2425 * Only topics with published and closed statuses are returned 2408 * Returns the forum's topic ids. 2409 * 2410 * Only topics with published and closed statuses are returned. 2426 2411 * 2427 2412 * @since 2.0.0 bbPress (r2908) 2428 2413 * 2429 * @param int $forum_id Forum id 2414 * @param int $forum_id Forum id. 2430 2415 */ 2431 2416 function bbp_forum_query_topic_ids( $forum_id ) { … … 2437 2422 2438 2423 /** 2439 * Returns the forum's subforum ids 2440 * 2441 * Only forums with published status are returned 2424 * Returns the forum's subforum ids. 2425 * 2426 * Only forums with published status are returned. 2442 2427 * 2443 2428 * @since 2.0.0 bbPress (r2908) 2444 2429 * 2445 * @param int $forum_id Forum id 2430 * @param int $forum_id Forum id. 2446 2431 */ 2447 2432 function bbp_forum_query_subforum_ids( $forum_id ) { … … 2453 2438 2454 2439 /** 2455 * Returns the forum's last reply id 2440 * Returns the forum's last reply id. 2456 2441 * 2457 2442 * @since 2.0.0 bbPress (r2908) 2458 * @since 2.6.0 bbPress (r5954) Replace direct queries with WP_Query() objects 2443 * @since 2.6.0 bbPress (r5954) Replace direct queries with WP_Query() objects. 2459 2444 * 2460 2445 * @param int $forum_id Forum id. … … 2504 2489 /** 2505 2490 * Check if it's a hidden forum or a topic or reply of a hidden forum and if 2506 * the user can't view it, then sets a 404 2491 * the user can't view it, then sets a 404. 2507 2492 * 2508 2493 * @since 2.0.0 bbPress (r2996) … … 2551 2536 /** 2552 2537 * Check if it's a private forum or a topic or reply of a private forum and if 2553 * the user can't view it, then sets a 404 2538 * the user can't view it, then sets a 404. 2554 2539 * 2555 2540 * @since 2.0.0 bbPress (r2996) … … 2599 2584 2600 2585 /** 2601 * Redirect if unauthorized user is attempting to edit a forum 2586 * Redirect if unauthorized user is attempting to edit a forum. 2602 2587 * 2603 2588 * @since 2.1.0 bbPress (r3607) … … 2617 2602 2618 2603 /** 2619 * Delete all topics (and their replies) for a specific forum ID 2604 * Delete all topics (and their replies) for a specific forum ID. 2620 2605 * 2621 2606 * @since 2.1.0 bbPress (r3668) 2622 2607 * 2623 2608 * @param int $forum_id 2624 * @return If forum is not valid2625 2609 */ 2626 2610 function bbp_delete_forum_topics( $forum_id = 0 ) { … … 2668 2652 2669 2653 /** 2670 * Trash all topics inside a forum 2654 * Trash all topics inside a forum. 2671 2655 * 2672 2656 * @since 2.1.0 bbPress (r3668) 2673 2657 * 2674 2658 * @param int $forum_id 2675 * @return If forum is not valid2676 2659 */ 2677 2660 function bbp_trash_forum_topics( $forum_id = 0 ) { … … 2736 2719 2737 2720 /** 2738 * Untrash all topics inside a forum 2721 * Untrash all topics inside a forum. 2739 2722 * 2740 2723 * @since 2.1.0 bbPress (r3668) 2741 2724 * 2742 2725 * @param int $forum_id 2743 * @return If forum is not valid2744 2726 */ 2745 2727 function bbp_untrash_forum_topics( $forum_id = 0 ) { … … 2792 2774 2793 2775 /** 2794 * Called before trashing a forum 2776 * Called before trashing a forum. 2795 2777 * 2796 2778 * This function is supplemental to the actual forum being trashed which is … … 2811 2793 2812 2794 /** 2813 * Called before untrashing a forum 2795 * Called before untrashing a forum. 2814 2796 * 2815 2797 * @since 2.1.0 bbPress (r3668) … … 2828 2810 2829 2811 /** 2830 * Called after deleting a forum 2812 * Called after deleting a forum. 2831 2813 * 2832 2814 * Try not to use this action. All meta & taxonomy terms have already been … … 2847 2829 2848 2830 /** 2849 * Called after trashing a forum 2831 * Called after trashing a forum. 2850 2832 * 2851 2833 * @since 2.1.0 bbPress (r3668) … … 2862 2844 2863 2845 /** 2864 * Called after untrashing a forum 2846 * Called after untrashing a forum. 2865 2847 * 2866 2848 * @since 2.1.0 bbPress (r3668)
Note: See TracChangeset
for help on using the changeset viewer.