PluginProbe
bbPress / 2.6.19
bbPress v2.6.19
2.6.19 2.6.18 2.6.17 trunk 2.0 2.0-beta-1 2.0-beta-2b 2.0-beta-3 2.0-beta-3b 2.0-rc-2 2.0-rc-3 2.0-rc-4 2.0-rc-5 2.0.1 2.0.2 2.0.3 2.1 2.1-beta-1 2.1-rc1 2.1-rc2 2.1-rc3 2.1-rc4 2.1.1 2.1.2 2.1.3 All 74 releases
← All changes | includes/replies/template.php +55 -40 2.6.17 → 2.6.19 View file →
@@ -14,9 +14,9 @@
14 14
15 15 /**
16 16 * Return the unique id of the custom post type for replies
17 17 *
18 - * @since 2.0.0 bbPress (r2857)
18 + * @since 2.0.0 bbPress (r2858)
19 19 *
20 20 */
21 21 function bbp_reply_post_type() {
22 22 echo bbp_get_reply_post_type();
@@ -23,9 +23,9 @@
23 23 }
24 24 /**
25 25 * Return the unique id of the custom post type for replies
26 26 *
27 - * @since 2.0.0 bbPress (r2857)
27 + * @since 2.0.0 bbPress (r2858)
28 28 *
29 29 * post type id
30 30 * @return string The unique reply post type id
31 31 */
@@ -37,9 +37,9 @@
37 37
38 38 /**
39 39 * Return array of labels used by the reply post type
40 40 *
41 - * @since 2.5.0 bbPress (r5129)
41 + * @since 2.5.0 bbPress (r5130)
42 42 *
43 43 * @return array
44 44 */
45 45 function bbp_get_reply_post_type_labels() {
@@ -86,9 +86,9 @@
86 86
87 87 /**
88 88 * Return array of reply post type rewrite settings
89 89 *
90 - * @since 2.5.0 bbPress (r5129)
90 + * @since 2.5.0 bbPress (r5130)
91 91 *
92 92 * @return array
93 93 */
94 94 function bbp_get_reply_post_type_rewrite() {
@@ -105,9 +105,9 @@
105 105
106 106 /**
107 107 * Return array of features the reply post type supports
108 108 *
109 - * @since 2.5.0 bbPress (r5129)
109 + * @since 2.5.0 bbPress (r5130)
110 110 *
111 111 * @return array
112 112 */
113 113 function bbp_get_reply_post_type_supports() {
@@ -198,9 +198,15 @@
198 198 // Get bbPress
199 199 $bbp = bbpress();
200 200
201 201 // Call the query
202 + if ( ! empty( $r['_bbp_public_topic_replies'] ) ) {
203 + add_filter( 'posts_where', 'bbp_public_topic_replies_where', 10, 2 );
204 + }
202 205 $bbp->reply_query = new WP_Query( $r );
206 + if ( ! empty( $r['_bbp_public_topic_replies'] ) ) {
207 + remove_filter( 'posts_where', 'bbp_public_topic_replies_where', 10 );
208 + }
203 209
204 210 // Maybe prime the post author caches
205 211 if ( ! empty( $r['update_post_family_cache'] ) ) {
206 212 bbp_update_post_family_caches( $bbp->reply_query->posts );
@@ -426,9 +432,9 @@
426 432
427 433 /**
428 434 * Output the paginated url to the reply in the reply loop
429 435 *
430 - * @since 2.0.0 bbPress (r2679)
436 + * @since 2.0.0 bbPress (r2680)
431 437 *
432 438 * @param int $reply_id Optional. Reply id
433 439 */
434 440 function bbp_reply_url( $reply_id = 0 ) {
@@ -436,9 +442,9 @@
436 442 }
437 443 /**
438 444 * Return the paginated url to the reply in the reply loop
439 445 *
440 - * @since 2.0.0 bbPress (r2679)
446 + * @since 2.0.0 bbPress (r2680)
441 447 *
442 448 * @param int $reply_id Optional. Reply id
443 449 * @param string $redirect_to Optional. Pass a redirect value for use with
444 450 * shortcodes and other fun things.
@@ -557,8 +563,13 @@
557 563 if ( ! empty( $post_title ) || ! bbp_is_reply( $post_id ) ) {
558 564 return $post_title;
559 565 }
560 566
567 + // Do not use an unreadable parent's title as the reply title.
568 + if ( ! bbp_user_can_embed_post( $post_id ) ) {
569 + return apply_filters( 'bbp_get_reply_title_fallback', esc_html__( 'Reply', 'bbpress' ), $post_id, '' );
570 + }
571 +
561 572 // Get reply topic title.
562 573 $topic_title = bbp_get_reply_topic_title( $post_id );
563 574
564 575 // Get empty reply title fallback.
@@ -584,9 +595,9 @@
584 595 }
585 596 /**
586 597 * Return the content of the reply
587 598 *
588 - * @since 2.0.0 bbPress (r2780)
599 + * @since 2.0.0 bbPress (r2553)
589 600 *
590 601 * @param int $reply_id Optional. reply id
591 602 * @return string Content of the reply
592 603 */
@@ -592,11 +603,12 @@
592 603 */
593 604 function bbp_get_reply_content( $reply_id = 0 ) {
594 605 $reply_id = bbp_get_reply_id( $reply_id );
595 606
596 - // Check if password is required
597 - if ( post_password_required( $reply_id ) ) {
598 - return get_the_password_form();
607 + // Check the reply and its topic and forum ancestors.
608 + $password_id = bbp_get_password_required_id( $reply_id );
609 + if ( ! empty( $password_id ) ) {
610 + return get_the_password_form( $password_id );
599 611 }
600 612
601 613 $content = get_post_field( 'post_content', $reply_id );
602 614
@@ -625,11 +637,14 @@
625 637 * letters
626 638 * @return string Reply Excerpt
627 639 */
628 640 function bbp_get_reply_excerpt( $reply_id = 0, $length = 100 ) {
629 - $reply_id = bbp_get_reply_id( $reply_id );
630 - $length = (int) $length;
631 - $excerpt = get_post_field( 'post_excerpt', $reply_id );
641 + $reply_id = bbp_get_reply_id( $reply_id );
642 + $length = (int) $length;
643 + $password_id = bbp_get_password_required_id( $reply_id );
644 + $excerpt = ! empty( $password_id )
645 + ? get_the_password_form( $password_id )
646 + : get_post_field( 'post_excerpt', $reply_id );
632 647
633 648 if ( empty( $excerpt ) ) {
634 649 $excerpt = bbp_get_reply_content( $reply_id );
635 650 }
@@ -654,9 +669,9 @@
654 669
655 670 /**
656 671 * Output the post date and time of a reply
657 672 *
658 - * @since 2.2.0 bbPress (r4155)
673 + * @since 2.2.0 bbPress (r4156)
659 674 *
660 675 * @param int $reply_id Optional. Reply id.
661 676 * @param bool $humanize Optional. Humanize output using time_since
662 677 * @param bool $gmt Optional. Use GMT
@@ -666,9 +681,9 @@
666 681 }
667 682 /**
668 683 * Return the post date and time of a reply
669 684 *
670 - * @since 2.2.0 bbPress (r4155)
685 + * @since 2.2.0 bbPress (r4156)
671 686 *
672 687 * @param int $reply_id Optional. Reply id.
673 688 * @param bool $humanize Optional. Humanize output using time_since
674 689 * @param bool $gmt Optional. Use GMT
@@ -883,9 +898,9 @@
883 898 * Is the reply publicly viewable?
884 899 *
885 900 * See bbp_get_public_reply_statuses() for public statuses.
886 901 *
887 - * @since 2.6.0 bbPress (r6391)
902 + * @since 2.6.0 bbPress (r6791)
888 903 *
889 904 * @param int $reply_id Optional. Reply id
890 905 * @return bool True if public, false if not.
891 906 */
@@ -901,9 +916,9 @@
901 916
902 917 /**
903 918 * Is the reply not spam or deleted?
904 919 *
905 - * @since 2.0.0 bbPress (r3496)
920 + * @since 2.0.0 bbPress (r3501)
906 921 * @since 2.6.0 bbPress (r6922) Returns false if topic is also not published
907 922 *
908 923 * @param int $reply_id Optional. Topic id
909 924 * @return bool True if published, false if not.
@@ -939,9 +954,9 @@
939 954
940 955 /**
941 956 * Is the reply trashed?
942 957 *
943 - * @since 2.0.0 bbPress (r2884)
958 + * @since 2.0.0 bbPress (r2892)
944 959 *
945 960 * @param int $reply_id Optional. Topic id
946 961 * @return bool True if spam, false if not.
947 962 */
@@ -1167,9 +1182,9 @@
1167 1182
1168 1183 /**
1169 1184 * Output the author link of the reply
1170 1185 *
1171 - * @since 2.0.0 bbPress (r2717)
1186 + * @since 2.0.0 bbPress (r2720)
1172 1187 *
1173 1188 * @param array $args Optional. If it is an integer, it is used as reply id.
1174 1189 */
1175 1190 function bbp_reply_author_link( $args = array() ) {
@@ -1177,9 +1192,9 @@
1177 1192 }
1178 1193 /**
1179 1194 * Return the author link of the reply
1180 1195 *
1181 - * @since 2.0.0 bbPress (r2717)
1196 + * @since 2.0.0 bbPress (r2720)
1182 1197 *
1183 1198 * @param array $args Optional. If an integer, it is used as reply id.
1184 1199 * @return string Author link of reply
1185 1200 */
@@ -1318,9 +1333,9 @@
1318 1333
1319 1334 /**
1320 1335 * Output the reply author email address
1321 1336 *
1322 - * @since 2.0.0 bbPress (r3445)
1337 + * @since 2.0.0 bbPress (r3446)
1323 1338 *
1324 1339 * @param int $reply_id Optional. Reply id
1325 1340 */
1326 1341 function bbp_reply_author_email( $reply_id = 0 ) {
@@ -1328,9 +1343,9 @@
1328 1343 }
1329 1344 /**
1330 1345 * Return the reply author email address
1331 1346 *
1332 - * @since 2.0.0 bbPress (r3445)
1347 + * @since 2.0.0 bbPress (r3446)
1333 1348 *
1334 1349 * @param int $reply_id Optional. Reply id
1335 1350 * @return string Reply author email address
1336 1351 */
@@ -1412,9 +1427,9 @@
1412 1427
1413 1428 /**
1414 1429 * Output the topic title a reply belongs to
1415 1430 *
1416 - * @since 2.0.0 bbPress (r2553)
1431 + * @since 2.0.0 bbPress (r2680)
1417 1432 *
1418 1433 * @param int $reply_id Optional. Reply id
1419 1434 */
1420 1435 function bbp_reply_topic_title( $reply_id = 0 ) {
@@ -1422,9 +1437,9 @@
1422 1437 }
1423 1438 /**
1424 1439 * Return the topic title a reply belongs to
1425 1440 *
1426 - * @since 2.0.0 bbPress (r2553)
1441 + * @since 2.0.0 bbPress (r2680)
1427 1442 *
1428 1443 * @param int $reply_id Optional. Reply id
1429 1444 * @return string The topic title of the reply
1430 1445 */
@@ -1474,9 +1489,9 @@
1474 1489
1475 1490 /**
1476 1491 * Output the forum id a reply belongs to
1477 1492 *
1478 - * @since 2.0.0 bbPress (r2679)
1493 + * @since 2.0.0 bbPress (r2680)
1479 1494 *
1480 1495 * @param int $reply_id Optional. Reply id
1481 1496 */
1482 1497 function bbp_reply_forum_id( $reply_id = 0 ) {
@@ -1484,9 +1499,9 @@
1484 1499 }
1485 1500 /**
1486 1501 * Return the forum id a reply belongs to
1487 1502 *
1488 - * @since 2.0.0 bbPress (r2679)
1503 + * @since 2.0.0 bbPress (r2680)
1489 1504 *
1490 1505 * @param int $reply_id Optional. Reply id
1491 1506 *
1492 1507 * @return int The forum id of the reply
@@ -2127,9 +2142,9 @@
2127 2142 * Move reply link
2128 2143 *
2129 2144 * Output the move link of the reply
2130 2145 *
2131 - * @since 2.3.0 bbPress (r4521)
2146 + * @since 2.3.0 bbPress (r4522)
2132 2147 *
2133 2148 * @param array $args See {@link bbp_get_reply_move_link()}
2134 2149 */
2135 2150 function bbp_reply_move_link( $args = array() ) {
@@ -2140,9 +2155,9 @@
2140 2155 * Get move reply link
2141 2156 *
2142 2157 * Return the move link of the reply
2143 2158 *
2144 - * @since 2.3.0 bbPress (r4521)
2159 + * @since 2.3.0 bbPress (r4522)
2145 2160 *
2146 2161 * @param array $args This function supports these arguments:
2147 2162 * - id: Reply id
2148 2163 * - link_before: HTML before the link
@@ -2169,10 +2184,10 @@
2169 2184 // Get IDs
2170 2185 $reply_id = bbp_get_reply_id( $r['id'] );
2171 2186 $topic_id = bbp_get_reply_topic_id( $reply_id );
2172 2187
2173 - // Bail if no reply ID or user cannot moderate
2174 - if ( empty( $reply_id ) || ! current_user_can( 'moderate', $topic_id ) ) {
2188 + // Bail if no reply ID or user cannot moderate and edit its topic
2189 + if ( empty( $reply_id ) || ! bbp_current_user_can_access_topic_moderation( $topic_id ) ) {
2175 2190 return;
2176 2191 }
2177 2192
2178 2193 $uri = add_query_arg(
@@ -2235,10 +2250,10 @@
2235 2250 // Get IDs
2236 2251 $reply_id = bbp_get_reply_id( $r['id'] );
2237 2252 $topic_id = bbp_get_reply_topic_id( $reply_id );
2238 2253
2239 - // Bail if no reply/topic ID, or user cannot moderate
2240 - if ( empty( $reply_id ) || empty( $topic_id ) || ! current_user_can( 'moderate', $topic_id ) ) {
2254 + // Bail if no reply/topic ID, or user cannot moderate and edit the topic
2255 + if ( empty( $reply_id ) || empty( $topic_id ) || ! bbp_current_user_can_access_topic_moderation( $topic_id ) ) {
2241 2256 return;
2242 2257 }
2243 2258
2244 2259 $uri = add_query_arg(
@@ -2395,9 +2410,9 @@
2395 2410
2396 2411 /**
2397 2412 * Return the base URL used inside of pagination links
2398 2413 *
2399 - * @since 2.6.0 bbPress (r6679)
2414 + * @since 2.6.0 bbPress (r6680)
2400 2415 *
2401 2416 * @param int $topic_id
2402 2417 * @return string
2403 2418 */
@@ -2549,9 +2564,9 @@
2549 2564
2550 2565 /**
2551 2566 * Output the value of reply content field
2552 2567 *
2553 - * @since 2.0.0 bbPress (r3130)
2568 + * @since 2.0.0 bbPress (r3101)
2554 2569 */
2555 2570 function bbp_form_reply_content() {
2556 2571 echo bbp_get_form_reply_content();
2557 2572 }
@@ -2557,9 +2572,9 @@
2557 2572 }
2558 2573 /**
2559 2574 * Return the value of reply content field
2560 2575 *
2561 - * @since 2.0.0 bbPress (r3130)
2576 + * @since 2.0.0 bbPress (r3101)
2562 2577 *
2563 2578 * @return string Value of reply content field
2564 2579 */
2565 2580 function bbp_get_form_reply_content() {
@@ -2700,9 +2715,9 @@
2700 2715
2701 2716 /**
2702 2717 * Output checked value of reply log edit field
2703 2718 *
2704 - * @since 2.0.0 bbPress (r3130)
2719 + * @since 2.0.0 bbPress (r3101)
2705 2720 */
2706 2721 function bbp_form_reply_log_edit() {
2707 2722 echo bbp_get_form_reply_log_edit();
2708 2723 }
@@ -2708,9 +2723,9 @@
2708 2723 }
2709 2724 /**
2710 2725 * Return checked value of reply log edit field
2711 2726 *
2712 - * @since 2.0.0 bbPress (r3130)
2727 + * @since 2.0.0 bbPress (r3101)
2713 2728 *
2714 2729 * @return string Reply log edit checked value
2715 2730 */
2716 2731 function bbp_get_form_reply_log_edit() {
@@ -2733,9 +2748,9 @@
2733 2748
2734 2749 /**
2735 2750 * Output the value of the reply edit reason
2736 2751 *
2737 - * @since 2.0.0 bbPress (r3130)
2752 + * @since 2.0.0 bbPress (r3101)
2738 2753 */
2739 2754 function bbp_form_reply_edit_reason() {
2740 2755 echo bbp_get_form_reply_edit_reason();
2741 2756 }
@@ -2741,9 +2756,9 @@
2741 2756 }
2742 2757 /**
2743 2758 * Return the value of the reply edit reason
2744 2759 *
2745 - * @since 2.0.0 bbPress (r3130)
2760 + * @since 2.0.0 bbPress (r3101)
2746 2761 *
2747 2762 * @return string Reply edit reason value
2748 2763 */
2749 2764 function bbp_get_form_reply_edit_reason() {