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/template.php +76 -27 2.6.18 → 2.6.19 View file →
@@ -152,9 +152,9 @@
152 152
153 153 /**
154 154 * Viewing a single forum
155 155 *
156 - * @since 2.0.0 bbPress (r3338)
156 + * @since 2.0.0 bbPress (r3344)
157 157 *
158 158 * @return bool
159 159 */
160 160 function bbp_is_single_forum() {
@@ -231,9 +231,9 @@
231 231
232 232 /**
233 233 * Viewing a single topic
234 234 *
235 - * @since 2.0.0 bbPress (r3338)
235 + * @since 2.0.0 bbPress (r3344)
236 236 *
237 237 * @return bool
238 238 */
239 239 function bbp_is_single_topic() {
@@ -382,9 +382,9 @@
382 382
383 383 /**
384 384 * Check if the current page is editing a topic tag
385 385 *
386 - * @since 2.0.0 bbPress (r3346)
386 + * @since 2.0.0 bbPress (r3348)
387 387 *
388 388 * @global string $pagenow The filename of the current screen.
389 389 * @global string $taxnow The taxonomy of the current screen.
390 390 *
@@ -420,9 +420,9 @@
420 420 /**
421 421 * Check if the current post type is one that comes with bbPress.
422 422 *
423 423 * @since 2.0.0 bbPress (r3311)
424 - * @since 2.6.17 bbPress Added support for post-type names and arrays.
424 + * @since 2.6.17 bbPress (r7500) Added support for post-type names and arrays.
425 425 *
426 426 * @param mixed $post_types Optional. Post object, post ID, post-type name, or
427 427 * an array of post-type names.
428 428 *
@@ -452,9 +452,9 @@
452 452
453 453 /**
454 454 * Check if a bbPress object or any of its parents is password protected.
455 455 *
456 - * @since 2.6.17
456 + * @since 2.6.17 bbPress (r7502)
457 457 *
458 458 * @param int $object_id Optional. Object ID. Defaults to the current post.
459 459 * @param string $object_type Optional. Object type. Defaults to 'post'.
460 460 * @return bool True if the object is password protected, otherwise false.
@@ -507,11 +507,60 @@
507 507 return (bool) apply_filters( 'bbp_is_password_protected', $retval, $object_id, $object_type );
508 508 }
509 509
510 510 /**
511 + * Get the bbPress object or ancestor whose password is still required.
512 + *
513 + * @since 2.6.19 bbPress (r7669)
514 + *
515 + * @param int $object_id Optional. Object ID. Defaults to the current post.
516 + * @return int Protected post ID, or zero if all passwords are satisfied.
517 + */
518 +function bbp_get_password_required_id( $object_id = 0 ) {
519 + $post = get_post( $object_id );
520 + $post_ids = array();
521 + $forum_id = 0;
522 +
523 + // Include the object
524 + if ( ! empty( $post ) && bbp_is_custom_post_type( $post ) ) {
525 + $object_id = $post->ID;
526 + $post_ids = array( $object_id );
527 +
528 + // Include the topic and forum for replies
529 + if ( bbp_is_reply( $object_id ) ) {
530 + $post_ids[] = bbp_get_reply_topic_id( $object_id );
531 + $forum_id = bbp_get_reply_forum_id( $object_id );
532 +
533 + // Include the forum for topics
534 + } elseif ( bbp_is_topic( $object_id ) ) {
535 + $forum_id = bbp_get_topic_forum_id( $object_id );
536 +
537 + // Include the forum itself
538 + } elseif ( bbp_is_forum( $object_id ) ) {
539 + $forum_id = $object_id;
540 + }
541 +
542 + // Include the forum and its ancestors
543 + if ( ! empty( $forum_id ) ) {
544 + $post_ids[] = $forum_id;
545 + $post_ids = array_merge( $post_ids, bbp_get_forum_ancestors( $forum_id ) );
546 + }
547 + }
548 +
549 + // Check the object and its parents
550 + foreach ( array_unique( array_filter( $post_ids ) ) as $post_id ) {
551 + if ( post_password_required( $post_id ) ) {
552 + return (int) $post_id;
553 + }
554 + }
555 +
556 + return 0;
557 +}
558 +
559 +/**
511 560 * Check if current page is a bbPress reply
512 561 *
513 - * @since 2.0.0 bbPress (r2549)
562 + * @since 2.0.0 bbPress (r2553)
514 563 *
515 564 * @param int $post_id Possible post_id to check
516 565 * @return bool True if it's a reply page, false if not
517 566 */
@@ -631,9 +680,9 @@
631 680
632 681 /**
633 682 * Check if current page is a bbPress user's subscriptions page (profile page)
634 683 *
635 - * @since 2.0.0 bbPress (r2652)
684 + * @since 2.0.0 bbPress (r2668)
636 685 *
637 686 * @return bool True if it's the subscriptions page, false if not
638 687 */
639 688 function bbp_is_subscriptions() {
@@ -681,9 +730,9 @@
681 730 /**
682 731 * Check if current page shows the replies created by a bbPress user (profile
683 732 * page)
684 733 *
685 - * @since 2.2.0 bbPress (r4225)
734 + * @since 2.2.0 bbPress (r4228)
686 735 *
687 736 * @return bool True if it's the replies created page, false if not
688 737 */
689 738 function bbp_is_replies_created() {
@@ -705,9 +754,9 @@
705 754
706 755 /**
707 756 * Check if current page is the currently logged in users author page
708 757 *
709 - * @since 2.0.0 bbPress (r2688)
758 + * @since 2.0.0 bbPress (r2660)
710 759 *
711 760 * @return bool True if it's the user's home, false if not
712 761 */
713 762 function bbp_is_user_home() {
@@ -749,9 +798,9 @@
749 798
750 799 /**
751 800 * Check if current page is a user profile page
752 801 *
753 - * @since 2.0.0 bbPress (r2688)
802 + * @since 2.0.0 bbPress (r3311)
754 803 *
755 804 * @return bool True if it's a user's profile page, false if not
756 805 */
757 806 function bbp_is_single_user() {
@@ -773,9 +822,9 @@
773 822
774 823 /**
775 824 * Check if current page is a user profile edit page
776 825 *
777 - * @since 2.0.0 bbPress (r2688)
826 + * @since 2.0.0 bbPress (r3311)
778 827 *
779 828 * @return bool True if it's a user's profile edit page, false if not
780 829 */
781 830 function bbp_is_single_user_edit() {
@@ -797,9 +846,9 @@
797 846
798 847 /**
799 848 * Check if current page is a user profile page
800 849 *
801 - * @since 2.2.0 bbPress (r4225)
850 + * @since 2.2.0 bbPress (r4228)
802 851 *
803 852 * @return bool True if it's a user's profile page, false if not
804 853 */
805 854 function bbp_is_single_user_profile() {
@@ -821,9 +870,9 @@
821 870
822 871 /**
823 872 * Check if current page is a user topics created page
824 873 *
825 - * @since 2.2.0 bbPress (r4225)
874 + * @since 2.2.0 bbPress (r4228)
826 875 *
827 876 * @return bool True if it's a user's topics page, false if not
828 877 */
829 878 function bbp_is_single_user_topics() {
@@ -845,9 +894,9 @@
845 894
846 895 /**
847 896 * Check if current page is a user replies created page
848 897 *
849 - * @since 2.2.0 bbPress (r4225)
898 + * @since 2.2.0 bbPress (r4228)
850 899 *
851 900 * @return bool True if it's a user's replies page, false if not
852 901 */
853 902 function bbp_is_single_user_replies() {
@@ -893,9 +942,9 @@
893 942
894 943 /**
895 944 * Check if current page is a view page
896 945 *
897 - * @since 2.0.0 bbPress (r2789)
946 + * @since 2.0.0 bbPress (r3311)
898 947 *
899 948 * @global WP_Query $wp_query To check if WP_Query::bbp_is_view is true
900 949 * @return bool Is it a view page?
901 950 */
@@ -1006,9 +1055,9 @@
1006 1055
1007 1056 /**
1008 1057 * Check if current page is an edit page
1009 1058 *
1010 - * @since 2.1.0 bbPress (r3585)
1059 + * @since 2.1.0 bbPress (r3586)
1011 1060 *
1012 1061 * @return bool True if it's the edit page, false if not
1013 1062 */
1014 1063 function bbp_is_edit() {
@@ -1172,9 +1221,9 @@
1172 1221 /**
1173 1222 * Output a small piece of JavaScript to replace the "bbp-no-js" body class
1174 1223 * with "bbp-js" to allow interactive & dynamic elements to work as intended.
1175 1224 *
1176 - * @since 2.6.10 bbPress (r7229)
1225 + * @since 2.6.10 bbPress (r7230)
1177 1226 */
1178 1227 function bbp_swap_no_js_body_class() {
1179 1228 static $done = false;
1180 1229
@@ -1204,9 +1253,9 @@
1204 1253 *
1205 1254 * A preliminary strpos() is performed before looping through each shortcode, to
1206 1255 * prevent unnecessarily processing.
1207 1256 *
1208 - * @since 2.6.0
1257 + * @since 2.6.0 bbPress (r6440)
1209 1258 *
1210 1259 * @param string $text
1211 1260 * @return bool
1212 1261 */
@@ -1368,9 +1417,9 @@
1368 1417
1369 1418 /**
1370 1419 * Return the login form action url
1371 1420 *
1372 - * @since 2.6.0 bbPress (r5684)
1421 + * @since 2.6.0 bbPress (r5685)
1373 1422 *
1374 1423 * @param array $args This function supports these arguments:
1375 1424 * - action: The action being taken
1376 1425 * - context: The context the action is being taken from
@@ -1540,9 +1589,9 @@
1540 1589 * override the "tabindex" attribute beyond what the browser naturally assigns.
1541 1590 *
1542 1591 * Most internal usages pass `false` which results in no attribute being used.
1543 1592 *
1544 - * @since 2.6.0 bbPress (r6424)
1593 + * @since 2.6.0 bbPress (r6433)
1545 1594 *
1546 1595 * @param mixed $tab False to skip, any integer to use
1547 1596 */
1548 1597 function bbp_tab_index_attribute( $tab = false ) {
@@ -1556,9 +1605,9 @@
1556 1605 * override the "tabindex" attribute beyond what the browser naturally assigns.
1557 1606 *
1558 1607 * Most internal usages pass `false` which results in no attribute being used.
1559 1608 *
1560 - * @since 2.6.0 bbPress (r6424)
1609 + * @since 2.6.0 bbPress (r6433)
1561 1610 *
1562 1611 * @param mixed $tab False to skip, any integer to use
1563 1612 *
1564 1613 * @return string
@@ -2063,9 +2112,9 @@
2063 2112
2064 2113 /**
2065 2114 * Edit TinyMCE plugins to match core behaviour
2066 2115 *
2067 - * @since 2.3.0 bbPress (r4574)
2116 + * @since 2.3.0 bbPress (r4576)
2068 2117 *
2069 2118 * @param array $plugins
2070 2119 * @see tiny_mce_plugins, teeny_mce_plugins
2071 2120 * @return array
@@ -2089,9 +2138,9 @@
2089 2138
2090 2139 /**
2091 2140 * Edit TeenyMCE buttons to match allowedtags
2092 2141 *
2093 - * @since 2.3.0 bbPress (r4605)
2142 + * @since 2.3.0 bbPress (r4606)
2094 2143 *
2095 2144 * @param array $buttons
2096 2145 * @see teeny_mce_buttons
2097 2146 * @return array
@@ -2118,9 +2167,9 @@
2118 2167
2119 2168 /**
2120 2169 * Edit TinyMCE quicktags buttons to match allowedtags
2121 2170 *
2122 - * @since 2.3.0 bbPress (r4606)
2171 + * @since 2.3.0 bbPress (r4607)
2123 2172 *
2124 2173 * @param array $settings
2125 2174 * @see quicktags_settings
2126 2175 * @return array Quicktags settings
@@ -2319,9 +2368,9 @@
2319 2368
2320 2369 /**
2321 2370 * Output the page title as a breadcrumb
2322 2371 *
2323 - * @since 2.0.0 bbPress (r2589)
2372 + * @since 2.0.0 bbPress (r2583)
2324 2373 *
2325 2374 * @param string $sep Separator. Defaults to '←'
2326 2375 * @param bool $current_page Include the current item
2327 2376 * @param bool $root Include the root page if one exists
@@ -2639,9 +2688,9 @@
2639 2688 *
2640 2689 * This is useful for displaying in the post area, which elements and
2641 2690 * attributes are supported. As well as any plugins which want to display it.
2642 2691 *
2643 - * @since 2.0.0 bbPress (r2780)
2692 + * @since 2.0.0 bbPress (r2782)
2644 2693 *
2645 2694 * @return string HTML allowed tags entity encoded.
2646 2695 */
2647 2696 function bbp_get_allowed_tags() {
@@ -2666,9 +2715,9 @@
2666 2715
2667 2716 /**
2668 2717 * Display possible errors & messages inside a template file
2669 2718 *
2670 - * @since 2.0.0 bbPress (r2688)
2719 + * @since 2.0.0 bbPress (r2970)
2671 2720 */
2672 2721 function bbp_template_notices() {
2673 2722
2674 2723 // Bail if no notices or errors