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/common/shortcodes.php +32 -21 2.6.17 → 2.6.19 View file →
@@ -13,9 +13,9 @@
13 13 if ( ! class_exists( 'BBP_Shortcodes' ) ) :
14 14 /**
15 15 * bbPress Shortcode Class
16 16 *
17 - * @since 2.0.0 bbPress (r3031)
17 + * @since 2.0.0 bbPress (r3032)
18 18 */
19 19 class BBP_Shortcodes {
20 20
21 21 /** Vars ******************************************************************/
@@ -29,9 +29,9 @@
29 29
30 30 /**
31 31 * Add the register_shortcodes action to bbp_init
32 32 *
33 - * @since 2.0.0 bbPress (r3031)
33 + * @since 2.0.0 bbPress (r3143)
34 34 *
35 35 */
36 36 public function __construct() {
37 37 $this->setup_globals();
@@ -40,9 +40,9 @@
40 40
41 41 /**
42 42 * Shortcode globals
43 43 *
44 - * @since 2.0.0 bbPress (r3143)
44 + * @since 2.0.0 bbPress (r3344)
45 45 *
46 46 * @access private
47 47 */
48 48 private function setup_globals() {
@@ -102,9 +102,9 @@
102 102
103 103 /**
104 104 * Register the bbPress shortcodes
105 105 *
106 - * @since 2.0.0 bbPress (r3031)
106 + * @since 2.0.0 bbPress (r3344)
107 107 */
108 108 private function add_shortcodes() {
109 109 foreach ( (array) $this->codes as $code => $function ) {
110 110 add_shortcode( $code, $function );
@@ -113,9 +113,9 @@
113 113
114 114 /**
115 115 * Unset some globals in the $bbp object that hold query related info
116 116 *
117 - * @since 2.0.0 bbPress (r3034)
117 + * @since 2.0.0 bbPress (r3344)
118 118 */
119 119 private function unset_globals() {
120 120 $bbp = bbpress();
121 121
@@ -144,9 +144,9 @@
144 144 * This is used to put the contents of the shortcode into a variable rather
145 145 * than outputting the HTML at run-time. This allows shortcodes to appear
146 146 * in the correct location in the_content() instead of when it's created.
147 147 *
148 - * @since 2.0.0 bbPress (r3079)
148 + * @since 2.0.0 bbPress (r3344)
149 149 *
150 150 * @param string $query_name
151 151 */
152 152 private function start( $query_name = '' ) {
@@ -160,9 +160,9 @@
160 160
161 161 /**
162 162 * Return the contents of the output buffer and flush its contents.
163 163 *
164 - * @since 2.0.0 bbPress (r3079)
164 + * @since 2.0.0 bbPress (r3344)
165 165 *
166 166 * @return string Contents of output buffer.
167 167 */
168 168 private function end() {
@@ -181,9 +181,9 @@
181 181
182 182 /**
183 183 * Filters the contents of the output buffer before returning.
184 184 *
185 - * @since 2.0.0 bbPress (r3079)
185 + * @since 2.6.0 bbPress (r6438)
186 186 *
187 187 * @param string $output The contents of the output buffer.
188 188 * @param string $query_name The query name used for this output.
189 189 */
@@ -195,9 +195,9 @@
195 195 /**
196 196 * Display an index of all visible root level forums in an output buffer
197 197 * and return to ensure that post/page contents are displayed first.
198 198 *
199 - * @since 2.0.0 bbPress (r3031)
199 + * @since 2.0.0 bbPress (r3032)
200 200 *
201 201 * @return string
202 202 */
203 203 public function display_forum_index() {
@@ -217,9 +217,9 @@
217 217 /**
218 218 * Display the contents of a specific forum ID in an output buffer
219 219 * and return to ensure that post/page contents are displayed first.
220 220 *
221 - * @since 2.0.0 bbPress (r3031)
221 + * @since 2.0.0 bbPress (r3032)
222 222 *
223 223 * @param array $attr
224 224 * @param string $content
225 225 * @return string
@@ -278,9 +278,9 @@
278 278 /**
279 279 * Display an index of all visible root level topics in an output buffer
280 280 * and return to ensure that post/page contents are displayed first.
281 281 *
282 - * @since 2.0.0 bbPress (r3031)
282 + * @since 2.0.0 bbPress (r3032)
283 283 *
284 284 * @return string
285 285 */
286 286 public function display_topic_index() {
@@ -306,9 +306,9 @@
306 306 /**
307 307 * Display the contents of a specific topic ID in an output buffer
308 308 * and return to ensure that post/page contents are displayed first.
309 309 *
310 - * @since 2.0.0 bbPress (r3031)
310 + * @since 2.0.0 bbPress (r3032)
311 311 *
312 312 * @param array $attr
313 313 * @param string $content
314 314 * @return string
@@ -331,8 +331,13 @@
331 331 if ( ! bbp_is_topic( $topic_id ) ) {
332 332 return $content;
333 333 }
334 334
335 + // Do not render a non-public topic for users who cannot read it.
336 + if ( ! bbp_is_topic_public( $topic_id ) && ! current_user_can( 'read_topic', $topic_id ) ) {
337 + return $content;
338 + }
339 +
335 340 // Reset the queries if not in theme compat
336 341 if ( ! bbp_is_theme_compat_active() ) {
337 342
338 343 $bbp = bbpress();
@@ -371,9 +376,9 @@
371 376 * Supports 'forum_id' attribute to display the topic form for a particular
372 377 * forum. This currently has styling issues from not being wrapped in
373 378 * <div id="bbpress-forums" class="bbpress-wrapper"></div> which will need to be sorted out later.
374 379 *
375 - * @since 2.0.0 bbPress (r3031)
380 + * @since 2.0.0 bbPress (r3042)
376 381 *
377 382 * @param array $attr
378 383 * @param string $content
379 384 * @return string
@@ -425,9 +430,9 @@
425 430 /**
426 431 * Display the contents of a specific reply ID in an output buffer
427 432 * and return to ensure that post/page contents are displayed first.
428 433 *
429 - * @since 2.0.0 bbPress (r3031)
434 + * @since 2.1.0 bbPress (r3634)
430 435 *
431 436 * @param array $attr
432 437 * @param string $content
433 438 * @return string
@@ -450,8 +455,14 @@
450 455 if ( ! bbp_is_reply( $reply_id ) ) {
451 456 return $content;
452 457 }
453 458
459 + // Do not render a non-public reply or its parent topic to unauthorized users.
460 + $topic_id = bbp_get_reply_topic_id( $reply_id );
461 + if ( ( ! bbp_is_reply_public( $reply_id ) && ! current_user_can( 'read_reply', $reply_id ) ) || ( ! bbp_is_topic_public( $topic_id ) && ! current_user_can( 'read_topic', $topic_id ) ) ) {
462 + return $content;
463 + }
464 +
454 465 // Reset the queries if not in theme compat
455 466 if ( ! bbp_is_theme_compat_active() ) {
456 467
457 468 $bbp = bbpress();
@@ -486,9 +497,9 @@
486 497 /**
487 498 * Display the reply form in an output buffer and return to ensure
488 499 * post/page contents are displayed first.
489 500 *
490 - * @since 2.0.0 bbPress (r3031)
501 + * @since 2.0.0 bbPress (r3042)
491 502 */
492 503 public function display_reply_form() {
493 504
494 505 // Start output buffer
@@ -506,9 +517,9 @@
506 517 /**
507 518 * Display a tag cloud of all topic tags in an output buffer and return to
508 519 * ensure that post/page contents are displayed first.
509 520 *
510 - * @since 2.0.0 bbPress (r3110)
521 + * @since 2.0.0 bbPress (r3132)
511 522 *
512 523 * @return string
513 524 */
514 525 public function display_topic_tags() {
@@ -536,9 +547,9 @@
536 547 /**
537 548 * Display the contents of a specific topic tag in an output buffer
538 549 * and return to ensure that post/page contents are displayed first.
539 550 *
540 - * @since 2.0.0 bbPress (r3110)
551 + * @since 2.0.0 bbPress (r3132)
541 552 *
542 553 * @param array $attr
543 554 * @param string $content
544 555 * @return string
@@ -574,9 +585,9 @@
574 585 /**
575 586 * Display the contents of a specific topic tag in an output buffer
576 587 * and return to ensure that post/page contents are displayed first.
577 588 *
578 - * @since 2.0.0 bbPress (r3346)
589 + * @since 2.0.0 bbPress (r3348)
579 590 *
580 591 * @return string
581 592 */
582 593 public function display_topic_tag_form() {
@@ -599,9 +610,9 @@
599 610 /**
600 611 * Display the contents of a specific view in an output buffer and return to
601 612 * ensure that post/page contents are displayed first.
602 613 *
603 - * @since 2.0.0 bbPress (r3031)
614 + * @since 2.0.0 bbPress (r3167)
604 615 *
605 616 * @param array $attr
606 617 * @param string $content
607 618 * @return string
@@ -640,9 +651,9 @@
640 651 /**
641 652 * Display the search form in an output buffer and return to ensure
642 653 * post/page contents are displayed first.
643 654 *
644 - * @since 2.3.0 bbPress (r4585)
655 + * @since 2.3.0 bbPress (r4586)
645 656 */
646 657 public function display_search_form() {
647 658
648 659 // Bail if search is disabled
@@ -794,9 +805,9 @@
794 805
795 806 /**
796 807 * Display forum statistics
797 808 *
798 - * @since 2.3.0 bbPress (r4509)
809 + * @since 2.3.0 bbPress (r4510)
799 810 *
800 811 * @return string
801 812 */
802 813 public function display_stats() {