| @@ -4,9 +4,9 @@ | ||
| 4 | 4 | * The bbPress Plugin |
| 5 | 5 | * |
| 6 | 6 | * bbPress is forum software with a twist from the creators of WordPress. |
| 7 | 7 | * |
| 8 | - * $Id: bbpress.php 7604 2026-09-21 14:19:57Z johnjamesjacoby $ | |
| 8 | + * $Id: bbpress.php 7745 2026-09-29 23:33:24Z johnjamesjacoby $ | |
| 9 | 9 | * |
| 10 | 10 | * @package bbPress |
| 11 | 11 | * @subpackage Main |
| 12 | 12 | */ |
| @@ -23,9 +23,9 @@ | ||
| 23 | 23 | * Domain Path: /languages/ |
| 24 | 24 | * Requires PHP: 7.2 |
| 25 | 25 | * Requires at least: 6.0 |
| 26 | 26 | * Tested up to: 7.1 |
| 27 | - * Version: 2.6.18 | |
| 27 | + * Version: 2.6.19 | |
| 28 | 28 | */ |
| 29 | 29 | |
| 30 | 30 | // Exit if accessed directly |
| 31 | 31 | defined( 'ABSPATH' ) || exit; |
| @@ -35,9 +35,9 @@ | ||
| 35 | 35 | * Main bbPress Class |
| 36 | 36 | * |
| 37 | 37 | * "Word hard. Stay bumble." |
| 38 | 38 | * |
| 39 | - * @since 2.0.0 bbPress (r2464) | |
| 39 | + * @since 2.0.0 bbPress (r2594) | |
| 40 | 40 | */ |
| 41 | 41 | final class bbPress { |
| 42 | 42 | |
| 43 | 43 | /** Magic *****************************************************************/ |
| @@ -103,9 +103,9 @@ | ||
| 103 | 103 | * |
| 104 | 104 | * Insures that only one instance of bbPress exists in memory at any one |
| 105 | 105 | * time. Also prevents needing to define globals all over the place. |
| 106 | 106 | * |
| 107 | - * @since 2.1.0 bbPress (r3757) | |
| 107 | + * @since 2.1.0 bbPress (r3758) | |
| 108 | 108 | * |
| 109 | 109 | * @staticvar object $instance |
| 110 | 110 | * @see bbpress() |
| 111 | 111 | * @return bbPress The one true bbPress |
| @@ -132,9 +132,9 @@ | ||
| 132 | 132 | |
| 133 | 133 | /** |
| 134 | 134 | * A dummy constructor to prevent bbPress from being loaded more than once. |
| 135 | 135 | * |
| 136 | - * @since 2.0.0 bbPress (r2464) | |
| 136 | + * @since 2.0.0 bbPress (r3071) | |
| 137 | 137 | * |
| 138 | 138 | * @see bbPress::instance() |
| 139 | 139 | * @see bbpress(); |
| 140 | 140 | */ |
| @@ -144,9 +144,9 @@ | ||
| 144 | 144 | |
| 145 | 145 | /** |
| 146 | 146 | * A dummy magic method to prevent bbPress from being cloned |
| 147 | 147 | * |
| 148 | - * @since 2.0.0 bbPress (r2464) | |
| 148 | + * @since 2.1.0 bbPress (r3758) | |
| 149 | 149 | */ |
| 150 | 150 | public function __clone() { |
| 151 | 151 | _doing_it_wrong( __FUNCTION__, __( 'Cheatin’ huh?', 'bbpress' ), '2.1' ); |
| 152 | 152 | } |
| @@ -153,9 +153,9 @@ | ||
| 153 | 153 | |
| 154 | 154 | /** |
| 155 | 155 | * A dummy magic method to prevent bbPress from being unserialized |
| 156 | 156 | * |
| 157 | - * @since 2.0.0 bbPress (r2464) | |
| 157 | + * @since 2.1.0 bbPress (r3758) | |
| 158 | 158 | */ |
| 159 | 159 | public function __wakeup() { |
| 160 | 160 | _doing_it_wrong( __FUNCTION__, __( 'Cheatin’ huh?', 'bbpress' ), '2.1' ); |
| 161 | 161 | } |
| @@ -191,9 +191,9 @@ | ||
| 191 | 191 | |
| 192 | 192 | /** |
| 193 | 193 | * Magic method for unsetting bbPress variables |
| 194 | 194 | * |
| 195 | - * @since 2.3.0 bbPress (r4628) | |
| 195 | + * @since 2.3.0 bbPress (r4629) | |
| 196 | 196 | */ |
| 197 | 197 | public function __unset( $key ) { |
| 198 | 198 | if ( isset( $this->data[ $key ] ) ) { |
| 199 | 199 | unset( $this->data[ $key ] ); |
| @@ -202,9 +202,9 @@ | ||
| 202 | 202 | |
| 203 | 203 | /** |
| 204 | 204 | * Magic method to prevent notices and errors from invalid method calls |
| 205 | 205 | * |
| 206 | - * @since 2.2.0 bbPress (r4252) | |
| 206 | + * @since 2.2.0 bbPress (r4253) | |
| 207 | 207 | */ |
| 208 | 208 | public function __call( $name = '', $args = array() ) { |
| 209 | 209 | unset( $name, $args ); |
| 210 | 210 | return null; |
| @@ -215,9 +215,9 @@ | ||
| 215 | 215 | /** |
| 216 | 216 | * Setup the environment variables to allow the rest of bbPress to function |
| 217 | 217 | * more easily. |
| 218 | 218 | * |
| 219 | - * @since 2.0.0 bbPress (r2626) | |
| 219 | + * @since 2.6.0 bbPress (r6331) | |
| 220 | 220 | * |
| 221 | 221 | * @access private |
| 222 | 222 | */ |
| 223 | 223 | private function setup_environment() { |
| @@ -223,10 +223,10 @@ | ||
| 223 | 223 | private function setup_environment() { |
| 224 | 224 | |
| 225 | 225 | /** Versions **********************************************************/ |
| 226 | 226 | |
| 227 | - $this->version = '2.6.18'; | |
| 228 | - $this->db_version = '263'; | |
| 227 | + $this->version = '2.6.19'; | |
| 228 | + $this->db_version = '264'; | |
| 229 | 229 | |
| 230 | 230 | /** Paths *************************************************************/ |
| 231 | 231 | |
| 232 | 232 | // File & base |
| @@ -253,9 +253,9 @@ | ||
| 253 | 253 | |
| 254 | 254 | /** |
| 255 | 255 | * Smart defaults to many bbPress specific class variables. |
| 256 | 256 | * |
| 257 | - * @since 2.6.0 bbPress (r6330) | |
| 257 | + * @since 2.6.0 bbPress (r6331) | |
| 258 | 258 | */ |
| 259 | 259 | private function setup_variables() { |
| 260 | 260 | |
| 261 | 261 | /** Identifiers *******************************************************/ |
| @@ -326,9 +326,9 @@ | ||
| 326 | 326 | |
| 327 | 327 | /** |
| 328 | 328 | * Include required files |
| 329 | 329 | * |
| 330 | - * @since 2.0.0 bbPress (r2626) | |
| 330 | + * @since 2.0.0 bbPress (r3334) | |
| 331 | 331 | * |
| 332 | 332 | * @access private |
| 333 | 333 | */ |
| 334 | 334 | private function includes() { |
| @@ -405,9 +405,9 @@ | ||
| 405 | 405 | |
| 406 | 406 | /** |
| 407 | 407 | * Setup the default hooks and actions |
| 408 | 408 | * |
| 409 | - * @since 2.0.0 bbPress (r2644) | |
| 409 | + * @since 2.0.0 bbPress (r3334) | |
| 410 | 410 | * |
| 411 | 411 | * @access private |
| 412 | 412 | */ |
| 413 | 413 | private function setup_actions() { |
| @@ -457,9 +457,9 @@ | ||
| 457 | 457 | * Note that since we currently have complete control over bbp-themes and |
| 458 | 458 | * the bbp-theme-compat folders, it's fine to hardcode these here. If at a |
| 459 | 459 | * later date we need to automate this, and API will need to be built. |
| 460 | 460 | * |
| 461 | - * @since 2.1.0 bbPress (r3829) | |
| 461 | + * @since 2.1.0 bbPress (r3830) | |
| 462 | 462 | */ |
| 463 | 463 | public function register_theme_packages() { |
| 464 | 464 | |
| 465 | 465 | // Register the basic theme stack. This is really dope. |
| @@ -480,9 +480,9 @@ | ||
| 480 | 480 | |
| 481 | 481 | /** |
| 482 | 482 | * Setup the default bbPress theme compatibility location. |
| 483 | 483 | * |
| 484 | - * @since 2.1.0 bbPress (r3778) | |
| 484 | + * @since 2.1.0 bbPress (r3779) | |
| 485 | 485 | */ |
| 486 | 486 | public function setup_theme() { |
| 487 | 487 | bbp_setup_theme_compat( bbp_get_theme_package_id() ); |
| 488 | 488 | } |
| @@ -495,9 +495,9 @@ | ||
| 495 | 495 | * Note that custom translation files inside the bbPress plugin folder |
| 496 | 496 | * will be removed on bbPress updates. If you're creating custom |
| 497 | 497 | * translation files, please use the global language folder. |
| 498 | 498 | * |
| 499 | - * @since 2.0.0 bbPress (r2596) | |
| 499 | + * @since 2.0.0 bbPress (r3333) | |
| 500 | 500 | */ |
| 501 | 501 | public function load_textdomain() { |
| 502 | 502 | |
| 503 | 503 | // Define the old directory |
| @@ -724,9 +724,9 @@ | ||
| 724 | 724 | |
| 725 | 725 | /** |
| 726 | 726 | * Register the topic tag and forum moderator taxonomies |
| 727 | 727 | * |
| 728 | - * @since 2.0.0 bbPress (r2464) Added bbp_get_topic_tag_tax_id() taxonomy | |
| 728 | + * @since 2.0.0 bbPress (r2753) Added bbp_get_topic_tag_tax_id() taxonomy | |
| 729 | 729 | */ |
| 730 | 730 | public static function register_taxonomies() { |
| 731 | 731 | |
| 732 | 732 | // Register the topic-tag taxonomy. |
| @@ -795,9 +795,9 @@ | ||
| 795 | 795 | |
| 796 | 796 | /** |
| 797 | 797 | * Register the bbPress shortcodes |
| 798 | 798 | * |
| 799 | - * @since 2.0.0 bbPress (r3031) | |
| 799 | + * @since 2.2.0 bbPress (r4212) | |
| 800 | 800 | */ |
| 801 | 801 | public function register_shortcodes() { |
| 802 | 802 | $this->shortcodes = new BBP_Shortcodes(); |
| 803 | 803 | } |
| @@ -806,9 +806,9 @@ | ||
| 806 | 806 | * Register bbPress meta-data |
| 807 | 807 | * |
| 808 | 808 | * Counts added in 2.6.0 to avoid negative values |
| 809 | 809 | * |
| 810 | - * @since 2.6.0 bbPress (r6300) | |
| 810 | + * @since 2.6.0 bbPress (r6302) | |
| 811 | 811 | */ |
| 812 | 812 | public function register_meta() { |
| 813 | 813 | |
| 814 | 814 | // Define "count" meta-type array |
| @@ -822,16 +822,16 @@ | ||
| 822 | 822 | |
| 823 | 823 | // Counts are single values |
| 824 | 824 | 'single' => true, |
| 825 | 825 | |
| 826 | - // Counts should be made available in REST | |
| 826 | + // Public counts should be made available in REST | |
| 827 | 827 | 'show_in_rest' => true, |
| 828 | 828 | |
| 829 | 829 | // Never allow counts to go negative |
| 830 | 830 | 'sanitize_callback' => 'bbp_number_not_negative', |
| 831 | 831 | |
| 832 | - // All users may update count meta data | |
| 833 | - 'auth_callback' => '__return_true' | |
| 832 | + // Derived counts cannot be edited through metadata endpoints | |
| 833 | + 'auth_callback' => '__return_false' | |
| 834 | 834 | ); |
| 835 | 835 | |
| 836 | 836 | /** Post **************************************************************/ |
| 837 | 837 | |
| @@ -841,12 +841,15 @@ | ||
| 841 | 841 | register_meta( 'post', '_bbp_total_topic_count', $count ); |
| 842 | 842 | register_meta( 'post', '_bbp_total_reply_count', $count ); |
| 843 | 843 | register_meta( 'post', '_bbp_voice_count', $count ); |
| 844 | 844 | register_meta( 'post', '_bbp_anonymous_reply_count', $count ); |
| 845 | - register_meta( 'post', '_bbp_topic_count_hidden', $count ); | |
| 846 | - register_meta( 'post', '_bbp_reply_count_hidden', $count ); | |
| 847 | - register_meta( 'post', '_bbp_total_topic_count_hidden', $count ); | |
| 848 | - register_meta( 'post', '_bbp_total_reply_count_hidden', $count ); | |
| 845 | + // Hidden counts must stay private if custom fields are exposed in REST. | |
| 846 | + $hidden_count = $count; | |
| 847 | + $hidden_count['show_in_rest'] = false; | |
| 848 | + register_meta( 'post', '_bbp_topic_count_hidden', $hidden_count ); | |
| 849 | + register_meta( 'post', '_bbp_reply_count_hidden', $hidden_count ); | |
| 850 | + register_meta( 'post', '_bbp_total_topic_count_hidden', $hidden_count ); | |
| 851 | + register_meta( 'post', '_bbp_total_reply_count_hidden', $hidden_count ); | |
| 849 | 852 | register_meta( 'post', '_bbp_forum_subforum_count', $count ); |
| 850 | 853 | |
| 851 | 854 | /** User **************************************************************/ |
| 852 | 855 | |
| @@ -863,9 +866,9 @@ | ||
| 863 | 866 | 'description' => esc_html__( 'bbPress User Activity', 'bbpress' ), |
| 864 | 867 | 'single' => true, |
| 865 | 868 | 'show_in_rest' => true, |
| 866 | 869 | 'sanitize_callback' => 'bbp_number_not_negative', |
| 867 | - 'auth_callback' => '__return_true' | |
| 870 | + 'auth_callback' => '__return_false' | |
| 868 | 871 | ) |
| 869 | 872 | ); |
| 870 | 873 | } |
| 871 | 874 | |
| @@ -880,9 +883,9 @@ | ||
| 880 | 883 | |
| 881 | 884 | /** |
| 882 | 885 | * Setup the user engagements strategy |
| 883 | 886 | * |
| 884 | - * @since 2.6.0 bbPress (r6875) | |
| 887 | + * @since 2.6.0 bbPress (r6876) | |
| 885 | 888 | */ |
| 886 | 889 | public function setup_engagements() { |
| 887 | 890 | |
| 888 | 891 | // Setup the class name |
| @@ -895,9 +898,9 @@ | ||
| 895 | 898 | |
| 896 | 899 | /** |
| 897 | 900 | * Initialize forum-specific roles |
| 898 | 901 | * |
| 899 | - * @since 2.6.0 | |
| 902 | + * @since 2.6.0 bbPress (r6118) | |
| 900 | 903 | */ |
| 901 | 904 | public function roles_init() { |
| 902 | 905 | |
| 903 | 906 | // Get role IDs |
| @@ -942,9 +945,9 @@ | ||
| 942 | 945 | * - Front-end editing |
| 943 | 946 | * - Topic views |
| 944 | 947 | * - User profiles |
| 945 | 948 | * |
| 946 | - * @since 2.0.0 bbPress (r2688) | |
| 949 | + * @since 2.4.0 bbPress (r4930) | |
| 947 | 950 | * |
| 948 | 951 | * @todo Extract into an API |
| 949 | 952 | */ |
| 950 | 953 | public static function add_rewrite_rules() { |
| @@ -1118,9 +1121,9 @@ | ||
| 1118 | 1121 | * to declare the global. |
| 1119 | 1122 | * |
| 1120 | 1123 | * Example: <?php $bbp = bbpress(); ?> |
| 1121 | 1124 | * |
| 1122 | - * @since 2.0.0 bbPress (r2464) | |
| 1125 | + * @since 2.1.0 bbPress (r3758) | |
| 1123 | 1126 | * |
| 1124 | 1127 | * @return bbPress The one true bbPress Instance |
| 1125 | 1128 | */ |
| 1126 | 1129 | function bbpress() { |