| @@ -15,9 +15,9 @@ | ||
| 15 | 15 | /** |
| 16 | 16 | * A wrapper for wp_insert_post() that also includes the necessary meta values |
| 17 | 17 | * for the topic to function properly. |
| 18 | 18 | * |
| 19 | - * @since 2.0.0 bbPress (r3349) | |
| 19 | + * @since 2.0.0 bbPress (r2970) | |
| 20 | 20 | * |
| 21 | 21 | * @param array $topic_data Forum post data |
| 22 | 22 | * @param array $topic_meta Forum meta data |
| 23 | 23 | */ |
| @@ -434,8 +434,10 @@ | ||
| 434 | 434 | |
| 435 | 435 | /** |
| 436 | 436 | * Handles the front end edit topic submission |
| 437 | 437 | * |
| 438 | + * @since 2.6.19 bbPress (r7680) Enforce the edit lock on submissions. | |
| 439 | + * | |
| 438 | 440 | * @param string $action The requested action to compare this function to |
| 439 | 441 | */ |
| 440 | 442 | function bbp_edit_topic_handler( $action = '' ) { |
| 441 | 443 | |
| @@ -472,8 +474,13 @@ | ||
| 472 | 474 | } elseif ( ! current_user_can( 'edit_topic', $topic_id ) ) { |
| 473 | 475 | bbp_add_error( 'bbp_edit_topic_permission', __( '<strong>Error</strong>: You do not have permission to edit that topic.', 'bbpress' ) ); |
| 474 | 476 | return; |
| 475 | 477 | |
| 478 | + // Authors cannot bypass the edit lock by submitting from another page | |
| 479 | + } elseif ( ( bbp_get_current_user_id() === (int) $topic->post_author ) && ! current_user_can( 'moderate', $topic_id ) && bbp_past_edit_lock( $topic->post_date_gmt ) ) { | |
| 480 | + bbp_add_error( 'bbp_edit_topic_permission', __( '<strong>Error</strong>: You do not have permission to edit that topic.', 'bbpress' ) ); | |
| 481 | + return; | |
| 482 | + | |
| 476 | 483 | // It is an anonymous post |
| 477 | 484 | } elseif ( bbp_is_topic_anonymous( $topic_id ) ) { |
| 478 | 485 | |
| 479 | 486 | // Filter anonymous data |
| @@ -776,9 +783,9 @@ | ||
| 776 | 783 | // Sticky check after 'bbp_new_topic' action so forum ID meta is set |
| 777 | 784 | if ( ! empty( $_POST['bbp_stick_topic'] ) && in_array( $_POST['bbp_stick_topic'], array_keys( $topic_types ), true ) ) { |
| 778 | 785 | |
| 779 | 786 | // What's the caps? |
| 780 | - if ( current_user_can( 'moderate', $topic_id ) ) { | |
| 787 | + if ( current_user_can( 'moderate', $topic_id ) && ( current_user_can( 'moderate' ) || ( 'super' !== $_POST['bbp_stick_topic'] && ! bbp_is_topic_super_sticky( $topic_id ) ) ) ) { | |
| 781 | 788 | |
| 782 | 789 | // What's the haps? |
| 783 | 790 | switch ( $_POST['bbp_stick_topic'] ) { |
| 784 | 791 | |
| @@ -868,9 +875,9 @@ | ||
| 868 | 875 | * meta data of forums above it. This calls several functions that all run |
| 869 | 876 | * manual queries against the database to get their results. As such, this |
| 870 | 877 | * function can be costly to run but is necessary to keep everything accurate. |
| 871 | 878 | * |
| 872 | - * @since 2.0.0 bbPress (r2800) | |
| 879 | + * @since 2.0.0 bbPress (r2895) | |
| 873 | 880 | * |
| 874 | 881 | * @param int $topic_id Topic id |
| 875 | 882 | * @param string $last_active_time Optional. Last active time |
| 876 | 883 | * @param int $forum_id Optional. Forum id |
| @@ -899,8 +906,13 @@ | ||
| 899 | 906 | |
| 900 | 907 | // Topic status |
| 901 | 908 | $topic_status = get_post_status( $topic_id ); |
| 902 | 909 | |
| 910 | + // Do not replace public forum activity with a non-public topic | |
| 911 | + if ( ( false === $refresh ) && ! bbp_is_topic_public( $topic_id ) ) { | |
| 912 | + return; | |
| 913 | + } | |
| 914 | + | |
| 903 | 915 | // If we want a full refresh, retain the resolved forum and query its values |
| 904 | 916 | if ( true === $refresh ) { |
| 905 | 917 | $topic_id = $reply_id = $active_id = $last_active_time = 0; |
| 906 | 918 | $topic_status = bbp_get_public_status_id(); |
| @@ -1106,9 +1118,8 @@ | ||
| 1106 | 1118 | |
| 1107 | 1119 | // Nonce check |
| 1108 | 1120 | if ( ! bbp_verify_nonce_request( 'bbp-merge-topic_' . $source_topic_id ) ) { |
| 1109 | 1121 | bbp_add_error( 'bbp_merge_topic_nonce', __( '<strong>Error</strong>: Are you sure you wanted to do that?', 'bbpress' ) ); |
| 1110 | - return; | |
| 1111 | 1122 | } |
| 1112 | 1123 | |
| 1113 | 1124 | // Get source topic |
| 1114 | 1125 | $source_topic = bbp_get_topic( $source_topic_id ); |
| @@ -1115,15 +1126,13 @@ | ||
| 1115 | 1126 | |
| 1116 | 1127 | // Source topic not found |
| 1117 | 1128 | if ( empty( $source_topic ) ) { |
| 1118 | 1129 | bbp_add_error( 'bbp_merge_topic_source_not_found', __( '<strong>Error</strong>: The topic you want to merge was not found.', 'bbpress' ) ); |
| 1119 | - return; | |
| 1120 | 1130 | } |
| 1121 | 1131 | |
| 1122 | - // Cannot edit source topic | |
| 1123 | - if ( ! current_user_can( 'edit_topic', $source_topic->ID ) ) { | |
| 1132 | + // User must moderate and edit the source topic | |
| 1133 | + if ( ! empty( $source_topic ) && ( ! current_user_can( 'moderate', $source_topic->ID ) || ! current_user_can( 'edit_topic', $source_topic->ID ) ) ) { | |
| 1124 | 1134 | bbp_add_error( 'bbp_merge_topic_source_permission', __( '<strong>Error</strong>: You do not have permission to edit the source topic.', 'bbpress' ) ); |
| 1125 | - return; | |
| 1126 | 1135 | } |
| 1127 | 1136 | |
| 1128 | 1137 | /** Destination Topic *****************************************************/ |
| 1129 | 1138 | |
| @@ -1141,10 +1150,15 @@ | ||
| 1141 | 1150 | if ( empty( $destination_topic ) ) { |
| 1142 | 1151 | bbp_add_error( 'bbp_merge_topic_destination_not_found', __( '<strong>Error</strong>: The topic you want to merge to was not found.', 'bbpress' ) ); |
| 1143 | 1152 | } |
| 1144 | 1153 | |
| 1145 | - // Cannot edit destination topic | |
| 1146 | - if ( ! current_user_can( 'edit_topic', $destination_topic->ID ) ) { | |
| 1154 | + // A topic cannot be merged with itself | |
| 1155 | + if ( ! empty( $source_topic ) && ! empty( $destination_topic ) && ( $source_topic->ID === $destination_topic->ID ) ) { | |
| 1156 | + bbp_add_error( 'bbp_merge_topic_destination_same', __( '<strong>Error</strong>: The destination topic must be different from the source topic.', 'bbpress' ) ); | |
| 1157 | + } | |
| 1158 | + | |
| 1159 | + // User must moderate and edit the destination topic | |
| 1160 | + if ( ! empty( $destination_topic ) && ( ! current_user_can( 'moderate', $destination_topic->ID ) || ! current_user_can( 'edit_topic', $destination_topic->ID ) ) ) { | |
| 1147 | 1161 | bbp_add_error( 'bbp_merge_topic_destination_permission', __( '<strong>Error</strong>: You do not have permission to edit the destination topic.', 'bbpress' ) ); |
| 1148 | 1162 | } |
| 1149 | 1163 | |
| 1150 | 1164 | // Bail if errors |
| @@ -1316,9 +1330,9 @@ | ||
| 1316 | 1330 | * When a topic is merged, update the counts of source and destination topic |
| 1317 | 1331 | * and their forums. |
| 1318 | 1332 | * |
| 1319 | 1333 | * @since 2.0.0 bbPress (r2756) |
| 1320 | - * @since 2.6.17 Recount both forums and topic engagements. | |
| 1334 | + * @since 2.6.17 bbPress (r7468) Recount both forums and topic engagements. | |
| 1321 | 1335 | * |
| 1322 | 1336 | * @param int $destination_topic_id Destination topic id. |
| 1323 | 1337 | * @param int $source_topic_id Source topic id. |
| 1324 | 1338 | * @param int $source_topic_forum_id Source topic's forum id. |
| @@ -1365,9 +1379,9 @@ | ||
| 1365 | 1379 | * |
| 1366 | 1380 | * Handles the front end split topic submission |
| 1367 | 1381 | * |
| 1368 | 1382 | * @since 2.0.0 bbPress (r2756) |
| 1369 | - * @since 2.6.17 Recount both forums and topic engagements. | |
| 1383 | + * @since 2.6.17 bbPress (r7468) Recount both forums and topic engagements. | |
| 1370 | 1384 | * |
| 1371 | 1385 | * @param string $action The requested action to compare this function to |
| 1372 | 1386 | */ |
| 1373 | 1387 | function bbp_split_topic_handler( $action = '' ) { |
| @@ -1400,23 +1414,24 @@ | ||
| 1400 | 1414 | |
| 1401 | 1415 | /** Topic to Split ********************************************************/ |
| 1402 | 1416 | |
| 1403 | 1417 | // Get the topic being split |
| 1404 | - $source_topic = bbp_get_topic( $from_reply->post_parent ); | |
| 1418 | + if ( ! empty( $from_reply ) ) { | |
| 1419 | + $source_topic = bbp_get_topic( $from_reply->post_parent ); | |
| 1420 | + } | |
| 1405 | 1421 | |
| 1406 | 1422 | // No topic |
| 1407 | - if ( empty( $source_topic ) ) { | |
| 1423 | + if ( ! empty( $from_reply ) && empty( $source_topic ) ) { | |
| 1408 | 1424 | bbp_add_error( 'bbp_split_topic_source_not_found', __( '<strong>Error</strong>: The topic you want to split was not found.', 'bbpress' ) ); |
| 1409 | 1425 | } |
| 1410 | 1426 | |
| 1411 | 1427 | // Nonce check failed |
| 1412 | - if ( ! bbp_verify_nonce_request( 'bbp-split-topic_' . $source_topic->ID ) ) { | |
| 1428 | + if ( ! empty( $source_topic ) && ! bbp_verify_nonce_request( 'bbp-split-topic_' . $source_topic->ID ) ) { | |
| 1413 | 1429 | bbp_add_error( 'bbp_split_topic_nonce', __( '<strong>Error</strong>: Are you sure you wanted to do that?', 'bbpress' ) ); |
| 1414 | - return; | |
| 1415 | 1430 | } |
| 1416 | 1431 | |
| 1417 | - // Use cannot edit topic | |
| 1418 | - if ( ! current_user_can( 'edit_topic', $source_topic->ID ) ) { | |
| 1432 | + // User must moderate and edit the source topic | |
| 1433 | + if ( ! empty( $source_topic ) && ( ! current_user_can( 'moderate', $source_topic->ID ) || ! current_user_can( 'edit_topic', $source_topic->ID ) ) ) { | |
| 1419 | 1434 | bbp_add_error( 'bbp_split_topic_source_permission', __( '<strong>Error</strong>: You do not have permission to edit the source topic.', 'bbpress' ) ); |
| 1420 | 1435 | } |
| 1421 | 1436 | |
| 1422 | 1437 | // How to Split |
| @@ -1451,10 +1466,15 @@ | ||
| 1451 | 1466 | if ( empty( $destination_topic ) ) { |
| 1452 | 1467 | bbp_add_error( 'bbp_split_topic_destination_not_found', __( '<strong>Error</strong>: The topic you want to split to was not found.', 'bbpress' ) ); |
| 1453 | 1468 | } |
| 1454 | 1469 | |
| 1455 | - // User cannot edit the destination topic | |
| 1456 | - if ( ! current_user_can( 'edit_topic', $destination_topic->ID ) ) { | |
| 1470 | + // A topic cannot be split into itself | |
| 1471 | + if ( ! empty( $source_topic ) && ! empty( $destination_topic ) && ( $source_topic->ID === $destination_topic->ID ) ) { | |
| 1472 | + bbp_add_error( 'bbp_split_topic_destination_same', __( '<strong>Error</strong>: The destination topic must be different from the source topic.', 'bbpress' ) ); | |
| 1473 | + } | |
| 1474 | + | |
| 1475 | + // User must moderate and edit the destination topic | |
| 1476 | + if ( ! empty( $destination_topic ) && ( ! current_user_can( 'moderate', $destination_topic->ID ) || ! current_user_can( 'edit_topic', $destination_topic->ID ) ) ) { | |
| 1457 | 1477 | bbp_add_error( 'bbp_split_topic_destination_permission', __( '<strong>Error</strong>: You do not have permission to edit the destination topic.', 'bbpress' ) ); |
| 1458 | 1478 | } |
| 1459 | 1479 | |
| 1460 | 1480 | break; |
| @@ -1704,9 +1724,9 @@ | ||
| 1704 | 1724 | * When a topic is split, update the counts of source and destination topic |
| 1705 | 1725 | * and their forums. |
| 1706 | 1726 | * |
| 1707 | 1727 | * @since 2.0.0 bbPress (r2756) |
| 1708 | - * @since 2.6.17 Recount both forums and topic engagements. | |
| 1728 | + * @since 2.6.17 bbPress (r7468) Recount both forums and topic engagements. | |
| 1709 | 1729 | * |
| 1710 | 1730 | * @param int $from_reply_id From reply id |
| 1711 | 1731 | * @param int $source_topic_id Source topic id |
| 1712 | 1732 | * @param int $destination_topic_id Destination topic id |
| @@ -1753,9 +1773,9 @@ | ||
| 1753 | 1773 | |
| 1754 | 1774 | /** |
| 1755 | 1775 | * Handles the front end tag management (renaming, merging, destroying) |
| 1756 | 1776 | * |
| 1757 | - * @since 2.0.0 bbPress (r2768) | |
| 1777 | + * @since 2.1.0 bbPress (r3671) | |
| 1758 | 1778 | * |
| 1759 | 1779 | * @param string $action The requested action to compare this function to |
| 1760 | 1780 | */ |
| 1761 | 1781 | function bbp_edit_topic_tag_handler( $action = '' ) { |
| @@ -1959,9 +1979,9 @@ | ||
| 1959 | 1979 | |
| 1960 | 1980 | /** |
| 1961 | 1981 | * Return an associative array of available topic statuses |
| 1962 | 1982 | * |
| 1963 | - * @since 2.4.0 bbPress (r5059) | |
| 1983 | + * @since 2.4.0 bbPress (r5060) | |
| 1964 | 1984 | * |
| 1965 | 1985 | * @param int $topic_id Optional. Topic id. |
| 1966 | 1986 | * |
| 1967 | 1987 | * @return array |
| @@ -1984,9 +2004,9 @@ | ||
| 1984 | 2004 | |
| 1985 | 2005 | /** |
| 1986 | 2006 | * Return an associative array of topic sticky types |
| 1987 | 2007 | * |
| 1988 | - * @since 2.4.0 bbPress (r5059) | |
| 2008 | + * @since 2.4.0 bbPress (r5060) | |
| 1989 | 2009 | * |
| 1990 | 2010 | * @param int $topic_id Optional. Topic id. |
| 1991 | 2011 | * |
| 1992 | 2012 | * @return array |
| @@ -2007,9 +2027,9 @@ | ||
| 2007 | 2027 | |
| 2008 | 2028 | /** |
| 2009 | 2029 | * Return array of available topic toggle actions |
| 2010 | 2030 | * |
| 2011 | - * @since 2.6.0 bbPress (r6133) | |
| 2031 | + * @since 2.6.0 bbPress (r6142) | |
| 2012 | 2032 | * |
| 2013 | 2033 | * @param int $topic_id Optional. Topic id. |
| 2014 | 2034 | * |
| 2015 | 2035 | * @return array |
| @@ -2032,9 +2052,9 @@ | ||
| 2032 | 2052 | |
| 2033 | 2053 | /** |
| 2034 | 2054 | * Return array of public topic statuses. |
| 2035 | 2055 | * |
| 2036 | - * @since 2.6.0 bbPress (r6383) | |
| 2056 | + * @since 2.6.0 bbPress (r6384) | |
| 2037 | 2057 | * |
| 2038 | 2058 | * @return array |
| 2039 | 2059 | */ |
| 2040 | 2060 | function bbp_get_public_topic_statuses() { |
| @@ -2049,9 +2069,9 @@ | ||
| 2049 | 2069 | |
| 2050 | 2070 | /** |
| 2051 | 2071 | * Return array of non-public topic statuses. |
| 2052 | 2072 | * |
| 2053 | - * @since 2.6.0 bbPress (r6642) | |
| 2073 | + * @since 2.6.0 bbPress (r6644) | |
| 2054 | 2074 | * |
| 2055 | 2075 | * @return array |
| 2056 | 2076 | */ |
| 2057 | 2077 | function bbp_get_non_public_topic_statuses() { |
| @@ -2147,13 +2167,19 @@ | ||
| 2147 | 2167 | return; |
| 2148 | 2168 | } |
| 2149 | 2169 | |
| 2150 | 2170 | // What is the user doing here? |
| 2151 | - if ( ! current_user_can( 'edit_topic', $topic_id ) || ( 'bbp_toggle_topic_trash' === $action && ! current_user_can( 'delete_topic', $topic_id ) ) ) { | |
| 2171 | + if ( ! current_user_can( 'edit_topic', $topic_id ) || ( 'bbp_toggle_topic_trash' === $action && ! current_user_can( 'delete_topic', $topic_id ) ) || ( 'bbp_toggle_topic_trash' !== $action && ! current_user_can( 'moderate', $topic_id ) ) ) { | |
| 2152 | 2172 | bbp_add_error( 'bbp_toggle_topic_permission', __( '<strong>Error</strong>: You do not have permission to do that.', 'bbpress' ) ); |
| 2153 | 2173 | return; |
| 2154 | 2174 | } |
| 2155 | 2175 | |
| 2176 | + // Super stickies affect every forum and require global moderation | |
| 2177 | + if ( ( 'bbp_toggle_topic_stick' === $action ) && ! current_user_can( 'moderate' ) && ( bbp_is_topic_super_sticky( $topic_id ) || ( ! bbp_is_topic_sticky( $topic_id ) && ! empty( $_GET['super'] ) && ( '1' === $_GET['super'] ) ) ) ) { | |
| 2178 | + bbp_add_error( 'bbp_toggle_topic_permission', __( '<strong>Error</strong>: You do not have permission to do that.', 'bbpress' ) ); | |
| 2179 | + return; | |
| 2180 | + } | |
| 2181 | + | |
| 2156 | 2182 | // Sub-action? |
| 2157 | 2183 | $sub_action = ! empty( $_GET['sub_action'] ) |
| 2158 | 2184 | ? sanitize_key( $_GET['sub_action'] ) |
| 2159 | 2185 | : false; |
| @@ -2191,9 +2217,9 @@ | ||
| 2191 | 2217 | * lifting when it comes to toggling topic. It only really makes sense to call |
| 2192 | 2218 | * within that context, so if you need to call this function directly, make sure |
| 2193 | 2219 | * you're also doing what the handler does too. |
| 2194 | 2220 | * |
| 2195 | - * @since 2.6.0 bbPress (r6133) | |
| 2221 | + * @since 2.6.0 bbPress (r6142) | |
| 2196 | 2222 | * @access private |
| 2197 | 2223 | * |
| 2198 | 2224 | * @param array $args |
| 2199 | 2225 | */ |
| @@ -2380,9 +2406,9 @@ | ||
| 2380 | 2406 | |
| 2381 | 2407 | /** |
| 2382 | 2408 | * Remove a deleted topic from all user subscriptions |
| 2383 | 2409 | * |
| 2384 | - * @since 2.0.0 bbPress (r2652) | |
| 2410 | + * @since 2.0.0 bbPress (r2668) | |
| 2385 | 2411 | * |
| 2386 | 2412 | * @param int $topic_id Get the topic id to remove |
| 2387 | 2413 | */ |
| 2388 | 2414 | function bbp_remove_topic_from_all_subscriptions( $topic_id = 0 ) { |
| @@ -2406,10 +2432,10 @@ | ||
| 2406 | 2432 | |
| 2407 | 2433 | /** |
| 2408 | 2434 | * Bump the total reply count of a topic |
| 2409 | 2435 | * |
| 2410 | - * @since 2.1.0 bbPress (r3825) | |
| 2411 | - * @since 2.6.17 Use atomic metadata writes and non-negative counts. | |
| 2436 | + * @since 2.1.0 bbPress (r3826) | |
| 2437 | + * @since 2.6.17 bbPress (r7468) Use atomic metadata writes and non-negative counts. | |
| 2412 | 2438 | * |
| 2413 | 2439 | * @param int $topic_id Optional. Topic id. |
| 2414 | 2440 | * @param int $difference Optional. Default 1 |
| 2415 | 2441 | * @return int Topic reply count |
| @@ -2500,10 +2526,10 @@ | ||
| 2500 | 2526 | |
| 2501 | 2527 | /** |
| 2502 | 2528 | * Bump the total hidden reply count of a topic |
| 2503 | 2529 | * |
| 2504 | - * @since 2.1.0 bbPress (r3825) | |
| 2505 | - * @since 2.6.17 Use atomic metadata writes and non-negative counts. | |
| 2530 | + * @since 2.1.0 bbPress (r3826) | |
| 2531 | + * @since 2.6.17 bbPress (r7468) Use atomic metadata writes and non-negative counts. | |
| 2506 | 2532 | * |
| 2507 | 2533 | * @param int $topic_id Optional. Topic id. |
| 2508 | 2534 | * @param int $difference Optional. Default 1 |
| 2509 | 2535 | * @return int Topic hidden reply count |
| @@ -2618,9 +2644,9 @@ | ||
| 2618 | 2644 | |
| 2619 | 2645 | /** |
| 2620 | 2646 | * Update the topic's forum id |
| 2621 | 2647 | * |
| 2622 | - * @since 2.0.0 bbPress (r2855) | |
| 2648 | + * @since 2.0.0 bbPress (r2858) | |
| 2623 | 2649 | * |
| 2624 | 2650 | * @param int $topic_id Optional. Topic id to update |
| 2625 | 2651 | * @param int $forum_id Optional. Forum id |
| 2626 | 2652 | * @return int Forum id |
| @@ -2646,9 +2672,9 @@ | ||
| 2646 | 2672 | |
| 2647 | 2673 | /** |
| 2648 | 2674 | * Update the topic's topic id |
| 2649 | 2675 | * |
| 2650 | - * @since 2.0.0 bbPress (r2954) | |
| 2676 | + * @since 2.0.0 bbPress (r2955) | |
| 2651 | 2677 | * |
| 2652 | 2678 | * @param int $topic_id Optional. Topic id to update |
| 2653 | 2679 | * @return int Topic id |
| 2654 | 2680 | */ |
| @@ -2662,9 +2688,9 @@ | ||
| 2662 | 2688 | |
| 2663 | 2689 | /** |
| 2664 | 2690 | * Adjust the total reply count of a topic |
| 2665 | 2691 | * |
| 2666 | - * @since 2.0.0 bbPress (r2467) | |
| 2692 | + * @since 2.0.0 bbPress (r2485) | |
| 2667 | 2693 | * |
| 2668 | 2694 | * @param int $topic_id Optional. Topic id to update |
| 2669 | 2695 | * @param int $reply_count Optional. Set the reply count manually. |
| 2670 | 2696 | * @return int Topic reply count |
| @@ -2690,9 +2716,9 @@ | ||
| 2690 | 2716 | /** |
| 2691 | 2717 | * Adjust the total hidden reply count of a topic (hidden includes trashed, |
| 2692 | 2718 | * spammed and pending replies) |
| 2693 | 2719 | * |
| 2694 | - * @since 2.0.0 bbPress (r2740) | |
| 2720 | + * @since 2.0.0 bbPress (r3349) | |
| 2695 | 2721 | * |
| 2696 | 2722 | * @param int $topic_id Optional. Topic id to update |
| 2697 | 2723 | * @param int $reply_count Optional. Set the reply count manually |
| 2698 | 2724 | * @return int Topic hidden reply count |
| @@ -2717,9 +2743,9 @@ | ||
| 2717 | 2743 | |
| 2718 | 2744 | /** |
| 2719 | 2745 | * Update the topic with the last active post ID |
| 2720 | 2746 | * |
| 2721 | - * @since 2.0.0 bbPress (r2888) | |
| 2747 | + * @since 2.0.0 bbPress (r2895) | |
| 2722 | 2748 | * |
| 2723 | 2749 | * @param int $topic_id Optional. Topic id to update |
| 2724 | 2750 | * @param int $active_id Optional. active id |
| 2725 | 2751 | * @return int Active id |
| @@ -2752,9 +2778,9 @@ | ||
| 2752 | 2778 | |
| 2753 | 2779 | /** |
| 2754 | 2780 | * Update the topics last active date/time (aka freshness) |
| 2755 | 2781 | * |
| 2756 | - * @since 2.0.0 bbPress (r2680) | |
| 2782 | + * @since 2.0.0 bbPress (r2895) | |
| 2757 | 2783 | * |
| 2758 | 2784 | * @param int $topic_id Optional. Topic id. |
| 2759 | 2785 | * @param string $new_time Optional. New time in mysql format. |
| 2760 | 2786 | * @return string MySQL timestamp of last active reply |
| @@ -2782,9 +2808,9 @@ | ||
| 2782 | 2808 | |
| 2783 | 2809 | /** |
| 2784 | 2810 | * Update the topic with the most recent reply ID |
| 2785 | 2811 | * |
| 2786 | - * @since 2.0.0 bbPress (r2625) | |
| 2812 | + * @since 2.0.0 bbPress (r2627) | |
| 2787 | 2813 | * |
| 2788 | 2814 | * @param int $topic_id Optional. Topic id to update |
| 2789 | 2815 | * @param int $reply_id Optional. Reply id |
| 2790 | 2816 | * @return int Reply id |
| @@ -2851,9 +2877,9 @@ | ||
| 2851 | 2877 | |
| 2852 | 2878 | /** |
| 2853 | 2879 | * Adjust the total anonymous reply count of a topic |
| 2854 | 2880 | * |
| 2855 | - * @since 2.0.0 bbPress (r2567) | |
| 2881 | + * @since 2.0.0 bbPress (r2918) | |
| 2856 | 2882 | * |
| 2857 | 2883 | * @param int $topic_id Optional. Topic id to update |
| 2858 | 2884 | * @return int Anonymous reply count |
| 2859 | 2885 | */ |
| @@ -3092,9 +3118,9 @@ | ||
| 3092 | 3118 | * Trash replies to a topic when it's marked as spam |
| 3093 | 3119 | * |
| 3094 | 3120 | * Usually you'll want to do this before the topic itself is marked as spam. |
| 3095 | 3121 | * |
| 3096 | - * @since 2.6.0 bbPress (r5405) | |
| 3122 | + * @since 2.6.0 bbPress (r5406) | |
| 3097 | 3123 | * |
| 3098 | 3124 | * @param int $topic_id |
| 3099 | 3125 | */ |
| 3100 | 3126 | function bbp_spam_topic_replies( $topic_id = 0 ) { |
| @@ -3147,9 +3173,9 @@ | ||
| 3147 | 3173 | * can be retrieved and unspammed later. |
| 3148 | 3174 | * |
| 3149 | 3175 | * Usually you'll want to do this before the topic itself is marked as spam. |
| 3150 | 3176 | * |
| 3151 | - * @since 2.6.0 bbPress (r5405) | |
| 3177 | + * @since 2.6.0 bbPress (r5406) | |
| 3152 | 3178 | * |
| 3153 | 3179 | * @param int $topic_id |
| 3154 | 3180 | */ |
| 3155 | 3181 | function bbp_spam_topic_tags( $topic_id = 0 ) { |
| @@ -3238,9 +3264,9 @@ | ||
| 3238 | 3264 | * Untrash replies to a topic previously marked as spam. |
| 3239 | 3265 | * |
| 3240 | 3266 | * Usually you'll want to do this after the topic is unspammed. |
| 3241 | 3267 | * |
| 3242 | - * @since 2.6.0 bbPress (r5405) | |
| 3268 | + * @since 2.6.0 bbPress (r5406) | |
| 3243 | 3269 | * |
| 3244 | 3270 | * @param int $topic_id |
| 3245 | 3271 | */ |
| 3246 | 3272 | function bbp_unspam_topic_replies( $topic_id = 0 ) { |
| @@ -3273,9 +3299,9 @@ | ||
| 3273 | 3299 | * Retrieve tags to a topic from post meta before it's unmarked as spam so they. |
| 3274 | 3300 | * |
| 3275 | 3301 | * Usually you'll want to do this before the topic itself is unmarked as spam. |
| 3276 | 3302 | * |
| 3277 | - * @since 2.6.0 bbPress (r5405) | |
| 3303 | + * @since 2.6.0 bbPress (r5406) | |
| 3278 | 3304 | * |
| 3279 | 3305 | * @param int $topic_id |
| 3280 | 3306 | */ |
| 3281 | 3307 | function bbp_unspam_topic_tags( $topic_id = 0 ) { |
| @@ -3514,9 +3540,9 @@ | ||
| 3514 | 3540 | * Delete replies to a topic when it's deleted |
| 3515 | 3541 | * |
| 3516 | 3542 | * Usually you'll want to do this before the topic itself is deleted. |
| 3517 | 3543 | * |
| 3518 | - * @since 2.6.0 bbPress (r5405) | |
| 3544 | + * @since 2.6.0 bbPress (r5406) | |
| 3519 | 3545 | * |
| 3520 | 3546 | * @param int $topic_id |
| 3521 | 3547 | */ |
| 3522 | 3548 | function bbp_delete_topic_replies( $topic_id = 0 ) { |
| @@ -3578,9 +3604,9 @@ | ||
| 3578 | 3604 | * Trash replies to a topic when it's trashed. |
| 3579 | 3605 | * |
| 3580 | 3606 | * Usually you'll want to do this before the topic itself is marked as spam. |
| 3581 | 3607 | * |
| 3582 | - * @since 2.6.0 bbPress (r5405) | |
| 3608 | + * @since 2.6.0 bbPress (r5406) | |
| 3583 | 3609 | * |
| 3584 | 3610 | * @param int $topic_id |
| 3585 | 3611 | */ |
| 3586 | 3612 | function bbp_trash_topic_replies( $topic_id = 0 ) { |
| @@ -3645,9 +3671,9 @@ | ||
| 3645 | 3671 | * Untrash replies to a topic previously trashed. |
| 3646 | 3672 | * |
| 3647 | 3673 | * Usually you'll want to do this after the topic is unspammed. |
| 3648 | 3674 | * |
| 3649 | - * @since 2.6.0 bbPress (r5405) | |
| 3675 | + * @since 2.6.0 bbPress (r5406) | |
| 3650 | 3676 | * |
| 3651 | 3677 | * @param int $topic_id |
| 3652 | 3678 | */ |
| 3653 | 3679 | function bbp_untrash_topic_replies( $topic_id = 0 ) { |
| @@ -3680,9 +3706,9 @@ | ||
| 3680 | 3706 | |
| 3681 | 3707 | /** |
| 3682 | 3708 | * Called after deleting a topic |
| 3683 | 3709 | * |
| 3684 | - * @since 2.0.0 bbPress (r2993) | |
| 3710 | + * @since 2.0.0 bbPress (r2895) | |
| 3685 | 3711 | */ |
| 3686 | 3712 | function bbp_deleted_topic( $topic_id = 0 ) { |
| 3687 | 3713 | $topic_id = bbp_get_topic_id( $topic_id ); |
| 3688 | 3714 | |
| @@ -3695,9 +3721,9 @@ | ||
| 3695 | 3721 | |
| 3696 | 3722 | /** |
| 3697 | 3723 | * Called after trashing a topic |
| 3698 | 3724 | * |
| 3699 | - * @since 2.0.0 bbPress (r2993) | |
| 3725 | + * @since 2.0.0 bbPress (r2895) | |
| 3700 | 3726 | */ |
| 3701 | 3727 | function bbp_trashed_topic( $topic_id = 0 ) { |
| 3702 | 3728 | $topic_id = bbp_get_topic_id( $topic_id ); |
| 3703 | 3729 | |
| @@ -3710,9 +3736,9 @@ | ||
| 3710 | 3736 | |
| 3711 | 3737 | /** |
| 3712 | 3738 | * Called after untrashing a topic |
| 3713 | 3739 | * |
| 3714 | - * @since 2.0.0 bbPress (r2993) | |
| 3740 | + * @since 2.0.0 bbPress (r2895) | |
| 3715 | 3741 | */ |
| 3716 | 3742 | function bbp_untrashed_topic( $topic_id = 0 ) { |
| 3717 | 3743 | $topic_id = bbp_get_topic_id( $topic_id ); |
| 3718 | 3744 | |
| @@ -3727,9 +3753,9 @@ | ||
| 3727 | 3753 | |
| 3728 | 3754 | /** |
| 3729 | 3755 | * Return the topics per page setting |
| 3730 | 3756 | * |
| 3731 | - * @since 2.0.0 bbPress (r3540) | |
| 3757 | + * @since 2.1.0 bbPress (r3572) | |
| 3732 | 3758 | * @return int |
| 3733 | 3759 | */ |
| 3734 | 3760 | function bbp_get_topics_per_page( $default = 15 ) { |
| 3735 | 3761 | |
| @@ -3747,9 +3773,9 @@ | ||
| 3747 | 3773 | |
| 3748 | 3774 | /** |
| 3749 | 3775 | * Return the topics per RSS page setting |
| 3750 | 3776 | * |
| 3751 | - * @since 2.0.0 bbPress (r3540) | |
| 3777 | + * @since 2.1.0 bbPress (r3572) | |
| 3752 | 3778 | * |
| 3753 | 3779 | * @param int $default Default replies per page (25) |
| 3754 | 3780 | * @return int |
| 3755 | 3781 | */ |
| @@ -3771,9 +3797,9 @@ | ||
| 3771 | 3797 | |
| 3772 | 3798 | /** |
| 3773 | 3799 | * Get topic tags for a specific topic ID |
| 3774 | 3800 | * |
| 3775 | - * @since 2.6.0 bbPress (r5836) | |
| 3801 | + * @since 2.6.0 bbPress (r5837) | |
| 3776 | 3802 | * |
| 3777 | 3803 | * @param int $topic_id |
| 3778 | 3804 | * |
| 3779 | 3805 | * @return string |
| @@ -3789,9 +3815,9 @@ | ||
| 3789 | 3815 | |
| 3790 | 3816 | /** |
| 3791 | 3817 | * Get topic tags for a specific topic ID |
| 3792 | 3818 | * |
| 3793 | - * @since 2.2.0 bbPress (r4165) | |
| 3819 | + * @since 2.2.0 bbPress (r4166) | |
| 3794 | 3820 | * |
| 3795 | 3821 | * @param int $topic_id |
| 3796 | 3822 | * @param string $sep |
| 3797 | 3823 | * |
| @@ -3810,9 +3836,9 @@ | ||
| 3810 | 3836 | |
| 3811 | 3837 | /** |
| 3812 | 3838 | * Get the topic-tag names a user is allowed to set on a topic. |
| 3813 | 3839 | * |
| 3814 | - * @since 2.6.17 bbPress | |
| 3840 | + * @since 2.6.17 bbPress (r7510) | |
| 3815 | 3841 | * |
| 3816 | 3842 | * @param int $topic_id Topic id. |
| 3817 | 3843 | * @param string $tag_names Comma-separated topic-tag names. |
| 3818 | 3844 | * @param int|bool $user_id User id. Default false for the current user. |
| @@ -3860,9 +3886,9 @@ | ||
| 3860 | 3886 | * |
| 3861 | 3887 | * @see https://bbpress.trac.wordpress.org/ticket/3043 |
| 3862 | 3888 | * @access private |
| 3863 | 3889 | * |
| 3864 | - * @since 2.6.0 bbPress (r6253) | |
| 3890 | + * @since 2.6.0 bbPress (r6254) | |
| 3865 | 3891 | * |
| 3866 | 3892 | * @param array $terms List of Term taxonomy IDs. |
| 3867 | 3893 | * @param object $taxonomy Current taxonomy object of terms. |
| 3868 | 3894 | */ |
| @@ -3916,9 +3942,9 @@ | ||
| 3916 | 3942 | |
| 3917 | 3943 | /** |
| 3918 | 3944 | * Check if autoembeds are enabled and hook them in if so |
| 3919 | 3945 | * |
| 3920 | - * @since 2.1.0 bbPress (r3752) | |
| 3946 | + * @since 2.1.0 bbPress (r3753) | |
| 3921 | 3947 | * |
| 3922 | 3948 | * @global WP_Embed $wp_embed |
| 3923 | 3949 | */ |
| 3924 | 3950 | function bbp_topic_content_autoembed() { |
| @@ -3982,14 +4008,14 @@ | ||
| 3982 | 4008 | bbp_the_topic(); ?> |
| 3983 | 4009 | |
| 3984 | 4010 | <item> |
| 3985 | 4011 | <guid><?php bbp_topic_permalink(); ?></guid> |
| 3986 | - <title><![CDATA[<?php bbp_topic_title(); ?>]]></title> | |
| 4012 | + <title><?php echo apply_filters( 'the_title_rss', bbp_get_topic_title() ); ?></title> | |
| 3987 | 4013 | <link><?php bbp_topic_permalink(); ?></link> |
| 3988 | 4014 | <pubDate><?php echo mysql2date( 'D, d M Y H:i:s +0000', get_post_meta( bbp_get_topic_id(), '_bbp_last_active_time', true ), false ); ?></pubDate> |
| 3989 | 4015 | <dc:creator><?php the_author(); ?></dc:creator> |
| 3990 | 4016 | |
| 3991 | - <?php if ( ! post_password_required() ) : ?> | |
| 4017 | + <?php if ( ! bbp_get_password_required_id( bbp_get_topic_id() ) ) : ?> | |
| 3992 | 4018 | |
| 3993 | 4019 | <description> |
| 3994 | 4020 | <![CDATA[ |
| 3995 | 4021 | <p><?php printf( |
| @@ -3996,9 +4022,9 @@ | ||
| 3996 | 4022 | /* translators: %s: Number of replies to the topic */ |
| 3997 | 4023 | esc_html__( 'Replies: %s', 'bbpress' ), |
| 3998 | 4024 | bbp_get_topic_reply_count() |
| 3999 | 4025 | ); ?></p> |
| 4000 | - <?php bbp_topic_content(); ?> | |
| 4026 | + <?php echo bbp_escape_feed_cdata( bbp_get_topic_content() ); ?> | |
| 4001 | 4027 | ]]> |
| 4002 | 4028 | </description> |
| 4003 | 4029 | |
| 4004 | 4030 | <?php rss_enclosure(); ?> |
| @@ -4025,9 +4051,9 @@ | ||
| 4025 | 4051 | |
| 4026 | 4052 | /** |
| 4027 | 4053 | * Redirect if unauthorized user is attempting to edit a topic |
| 4028 | 4054 | * |
| 4029 | - * @since 2.1.0 bbPress (r3605) | |
| 4055 | + * @since 2.1.0 bbPress (r3607) | |
| 4030 | 4056 | */ |
| 4031 | 4057 | function bbp_check_topic_edit() { |
| 4032 | 4058 | |
| 4033 | 4059 | // Bail if not editing a topic |
| @@ -4043,9 +4069,9 @@ | ||
| 4043 | 4069 | |
| 4044 | 4070 | /** |
| 4045 | 4071 | * Redirect if unauthorized user is attempting to edit a topic tag |
| 4046 | 4072 | * |
| 4047 | - * @since 2.1.0 bbPress (r3605) | |
| 4073 | + * @since 2.1.0 bbPress (r3607) | |
| 4048 | 4074 | */ |
| 4049 | 4075 | function bbp_check_topic_tag_edit() { |
| 4050 | 4076 | |
| 4051 | 4077 | // Bail if not editing a topic tag |