Changeset 7268
- Timestamp:
- 06/28/2024 10:02:43 PM (13 months ago)
- Location:
- trunk
- Files:
-
- 1 added
- 24 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
-
Property
svn:mergeinfo
set to
/branches/2.6 merged eligible
-
Property
svn:mergeinfo
set to
-
trunk/bbpress.php
r7232 r7268 23 23 * Domain Path: /languages/ 24 24 * Requires PHP: 5.6.20 25 * Requires at least: 5.0 25 * Requires at least: 6.0 26 * Tested up to: 6.5 26 27 * Version: 2.7.0-alpha-2 27 28 */ -
trunk/package.json
r7219 r7268 1 1 { 2 2 "name": "bbpress", 3 "author": "The bbPress Contributors", 3 4 "author": "The bbPress Contributors", 4 5 "description": "Forum software with a twist from the creators of WordPress.", -
trunk/src/bbpress.php
r7232 r7268 23 23 * Domain Path: /languages/ 24 24 * Requires PHP: 5.6.20 25 * Requires at least: 5.0 25 * Requires at least: 6.0 26 * Tested up to: 6.5 26 27 * Version: 2.7.0-alpha-2 27 28 */ -
trunk/src/includes/admin/assets/css/admin.css
r7171 r7268 1 1 2 /* Kludge for too-wide forums dropdown*/2 /* Kludge for too-wide inputs & selects */ 3 3 #poststuff #bbp_forum_attributes select#parent_id, 4 #poststuff #bbp_forum_attributes input#menu_order, 4 5 #poststuff #bbp_topic_attributes select#parent_id, 5 6 #poststuff #bbp_reply_attributes select#bbp_forum_id, 6 #poststuff #bbp_reply_attributes select#bbp_reply_to { 7 #poststuff #bbp_reply_attributes select#bbp_reply_to, 8 #poststuff #bbp_reply_attributes input#bbp_forum_id, 9 #poststuff #bbp_reply_attributes input#bbp_topic_id, 10 #poststuff #bbp_author_metabox input#bbp_author_id, 11 #poststuff #bbp_author_metabox input#bbp_author_ip_address { 7 12 max-width: 170px; 8 13 } … … 316 321 } 317 322 323 body.post-type-forum .wp-list-table thead th a, 324 body.post-type-forum .wp-list-table tfoot th a, 325 body.post-type-topic .wp-list-table thead th a, 326 body.post-type-topic .wp-list-table tfoot th a, 327 body.post-type-reply .wp-list-table thead th a, 328 body.post-type-reply .wp-list-table tfoot th a { 329 display: flex; 330 } 331 332 body.post-type-forum .wp-list-table thead th:not(.sortable), 333 body.post-type-forum .wp-list-table tfoot th:not(.sortable), 334 body.post-type-forum .wp-list-table thead th a > span:first-child, 335 body.post-type-forum .wp-list-table tfoot th a > span:first-child, 336 body.post-type-forum .wp-list-table tbody td, 337 body.post-type-topic .wp-list-table thead th:not(.sortable), 338 body.post-type-topic .wp-list-table tfoot th:not(.sortable), 339 body.post-type-topic .wp-list-table thead th a > span:first-child, 340 body.post-type-topic .wp-list-table tfoot th a > span:first-child, 341 body.post-type-topic .wp-list-table tbody td, 342 body.post-type-reply .wp-list-table thead th:not(.sortable), 343 body.post-type-reply .wp-list-table tfoot th:not(.sortable), 344 body.post-type-reply .wp-list-table thead th a > span:first-child, 345 body.post-type-reply .wp-list-table tfoot th a > span:first-child, 346 body.post-type-reply .wp-list-table tbody td { 347 overflow-x: hidden; 348 text-overflow: ellipsis; 349 word-wrap: normal; 350 } 351 318 352 .column-bbp_forum_topic_count, 319 353 .column-bbp_forum_reply_count, -
trunk/src/includes/admin/classes/class-bbp-admin.php
r7190 r7268 82 82 */ 83 83 public $notices = array(); 84 85 /** Components ************************************************************/ 86 87 /** 88 * @var BBP_Forums_Admin Forums admin 89 */ 90 public $forums = null; 91 92 /** 93 * @var BBP_Topics_Admin Topics admin 94 */ 95 public $topics = null; 96 97 /** 98 * @var BBP_Replies_Admin Replies admin 99 */ 100 public $replies = null; 101 102 /** 103 * @var BBP_Converter Converter admin 104 */ 105 public $converter = null; 84 106 85 107 /** Functions *************************************************************/ -
trunk/src/includes/admin/classes/class-bbp-converter-db.php
r6785 r7268 31 31 */ 32 32 public function __construct( $dbuser, $dbpassword, $dbname, $dbhost ) { 33 register_shutdown_function( array( $this, '__destruct' ) );34 33 35 34 if ( WP_DEBUG && WP_DEBUG_DISPLAY ) { -
trunk/src/includes/admin/tools/repair.php
r7134 r7268 498 498 $result = esc_html__( 'Failed!', 'bbpress' ); 499 499 500 $sql_select = "SELECT `post_author`, COUNT(DISTINCT `ID`) as `_count` FROM `{$bbp_db->posts}` WHERE `post_type` = '" . bbp_get_topic_post_type() . "' AND `post_status` = '" . bbp_get_public_status_id() . "' GROUP BY `post_author`"; 500 $sql_type = bbp_get_topic_post_type(); 501 $sql_status = "'" . implode( "','", bbp_get_public_topic_statuses() ) . "'"; 502 $sql_select = "SELECT `post_author`, COUNT(DISTINCT `ID`) as `_count` FROM `{$bbp_db->posts}` WHERE `post_type` = '{$sql_type}' AND `post_status` IN ({$sql_status}) GROUP BY `post_author`"; 501 503 $insert_rows = $bbp_db->get_results( $sql_select ); 502 504 … … 542 544 543 545 // Define variables 544 $bbp_db = bbp_db();546 $bbp_db = bbp_db(); 545 547 $statement = esc_html__( 'Counting the number of topics to which each user has replied… %s', 'bbpress' ); 546 548 $result = esc_html__( 'Failed!', 'bbpress' ); 547 549 548 $sql_select = "SELECT `post_author`, COUNT(DISTINCT `ID`) as `_count` FROM `{$bbp_db->posts}` WHERE `post_type` = '" . bbp_get_reply_post_type() . "' AND `post_status` = '" . bbp_get_public_status_id() . "' GROUP BY `post_author`"; 550 $sql_type = bbp_get_reply_post_type(); 551 $sql_status = "'" . implode( "','", bbp_get_public_reply_statuses() ) . "'"; 552 $sql_select = "SELECT `post_author`, COUNT(DISTINCT `ID`) as `_count` FROM `{$bbp_db->posts}` WHERE `post_type` = '{$sql_type}' AND `post_status` IN ({$sql_status}) GROUP BY `post_author`"; 549 553 $insert_rows = $bbp_db->get_results( $sql_select ); 550 554 … … 602 606 } 603 607 604 $topics = $bbp_db->get_col( "SELECT `ID` FROM `{$bbp_db->posts}` WHERE `post_type` = '" . bbp_get_topic_post_type() . "' AND `post_status` = '" . bbp_get_public_status_id() . "'" ); 605 608 $sql_type = bbp_get_topic_post_type(); 609 $sql_status = "'" . implode( "','", bbp_get_public_topic_statuses() ) . "'"; 610 $sql_select = "SELECT `ID` FROM `{$bbp_db->posts}` WHERE `post_type` = '{$sql_type}' AND `post_status` IN ({$sql_status})"; 611 612 $topics = $bbp_db->get_col( $sql_select ); 606 613 if ( is_wp_error( $topics ) ) { 607 614 return array( 2, sprintf( $statement, $result ) ); … … 668 675 } 669 676 670 $topics = $bbp_db->get_col( "SELECT `ID` FROM `{$bbp_db->posts}` WHERE `post_type` = '" . bbp_get_topic_post_type() . "' AND `post_status` = '" . bbp_get_public_status_id() . "'" ); 677 $sql_type = bbp_get_topic_post_type(); 678 $sql_status = "'" . implode( "','", bbp_get_public_topic_statuses() ) . "'"; 679 $sql_select = "SELECT `ID` FROM `{$bbp_db->posts}` WHERE `post_type` = '{$sql_type}' AND `post_status` IN ({$sql_status})"; 680 681 $topics = $bbp_db->get_col( $sql_select ); 671 682 if ( is_wp_error( $topics ) ) { 672 683 return array( 2, sprintf( $statement, $result ) ); … … 733 744 } 734 745 735 $forums = $bbp_db->get_col( "SELECT `ID` FROM `{$bbp_db->posts}` WHERE `post_type` = '" . bbp_get_forum_post_type() . "' AND `post_status` = '" . bbp_get_public_status_id() . "'" ); 746 $sql_type = bbp_get_forum_post_type(); 747 $sql_status = "'" . implode( "','", bbp_get_public_forum_statuses() ) . "'"; 748 $sql_select = "SELECT `ID` FROM `{$bbp_db->posts}` WHERE `post_type` = '{$sql_type}' AND `post_status` IN ({$sql_status})"; 749 750 $forums = $bbp_db->get_col( $sql_select ); 736 751 if ( is_wp_error( $forums ) ) { 737 752 return array( 2, sprintf( $statement, $result ) ); -
trunk/src/includes/common/functions.php
r7249 r7268 484 484 485 485 // Declare empty arrays 486 $ topics = $topic_titles = array_fill_keys( bbp_get_non_public_reply_statuses(), '' );486 $replies = $reply_titles = array_fill_keys( bbp_get_non_public_reply_statuses(), '' ); 487 487 488 488 // Pending … … 517 517 518 518 // Total hidden (pending, private, hidden, spam, trash) 519 $reply_count_hidden = array_sum( $replies);519 $reply_count_hidden = array_sum( array_filter( $replies ) ); 520 520 521 521 // Compile the hidden replies title … … 2520 2520 $the_query = bbp_get_view_query_args( $view ); 2521 2521 2522 // Output the feed 2523 bbp_display_topics_feed_rss2( $the_query ); 2522 // Output the feed if view exists 2523 if ( ! empty( $the_query ) ) { 2524 bbp_display_topics_feed_rss2( $the_query ); 2525 } 2524 2526 } 2525 2527 } -
trunk/src/includes/core/capabilities.php
r6777 r7268 286 286 function bbp_add_forums_roles( $wp_roles = null ) { 287 287 288 // Maybe initialize WP_Roles just-in-time, but 289 if ( empty( $wp_roles ) && ! doing_action( 'wp_roles_init' ) ) { 290 $wp_roles = wp_roles(); 291 } 292 293 // Bail if unexpected param type 294 if ( ! is_a( $wp_roles, 'WP_Roles' ) ) { 295 return; 296 } 297 288 298 // Get the dynamic roles 289 299 $bbp_roles = bbp_get_dynamic_roles(); -
trunk/src/includes/extend/akismet.php
r7226 r7268 21 21 */ 22 22 class BBP_Akismet { 23 24 /** 25 * The last post checked by Akismet. 26 * 27 * @since 2.0.0 bbPress (r3277) 28 * 29 * @var array $last_post Default empty array. 30 */ 31 protected $last_post = array(); 23 32 24 33 /** -
trunk/src/includes/forums/functions.php
r7207 r7268 2302 2302 } 2303 2303 2304 // Get query post types array . 2305 $post_types = (array) $posts_query->get( 'post_type' ); 2304 // Bail to prevent unintended wp-admin post_row overrides 2305 if ( is_admin() && isset( $_REQUEST['post_status'] ) ) { 2306 return; 2307 } 2308 2309 // Get query post types as an array. 2310 $post_types = array_filter( (array) $posts_query->get( 'post_type' ) ); 2306 2311 2307 2312 // Forums 2308 if ( bbp_get_forum_post_type() === implode( '', $post_types ) ) { 2309 2310 // Prevent accidental wp-admin post_row override 2311 if ( is_admin() && isset( $_REQUEST['post_status'] ) ) { 2312 return; 2313 } 2313 if ( in_array( bbp_get_forum_post_type(), $post_types, true ) ) { 2314 2314 2315 2315 /** Default ***********************************************************/ … … 2319 2319 2320 2320 // Get forums to exclude 2321 $ hidden_ids = bbp_exclude_forum_ids( 'array' );2322 2323 // Bail if no forums to exclude2324 if ( empty( $hidden_ids ) ) {2325 return; 2326 }2327 2328 // Get any existing meta queries 2329 $not_in = $posts_query->get( 'post__not_in', array() );2330 2331 // Add our meta query to existing 2332 $not_in = array_unique( array_merge( $not_in, $hidden_ids ) );2333 2334 // Set the meta_query var2335 $posts_query->set( 'post__not_in', $not_in );2321 $forum_ids = bbp_exclude_forum_ids( 'array' ); 2322 2323 // Excluding some forums 2324 if ( ! empty( $forum_ids ) ) { 2325 2326 // Get any existing not-in queries 2327 $not_in = $posts_query->get( 'post__not_in', array() ); 2328 2329 // Add our not-in to existing 2330 $not_in = array_unique( array_merge( $not_in, $forum_ids ) ); 2331 2332 // Set the new not-in val 2333 $posts_query->set( 'post__not_in', $not_in ); 2334 } 2335 } 2336 2336 2337 2337 // Some other post type besides Forums, Topics, or Replies 2338 } elseif ( ! array_diff( $post_types, bbp_get_post_types() ) ) {2338 if ( ! array_diff( $post_types, bbp_get_post_types() ) ) { 2339 2339 2340 2340 // Get forums to exclude 2341 2341 $forum_ids = bbp_exclude_forum_ids( 'meta_query' ); 2342 2342 2343 // Bail if no forums to exclude 2344 if ( empty( $forum_ids ) ) { 2345 return; 2346 } 2347 2348 // Get any existing meta queries 2349 $meta_query = (array) $posts_query->get( 'meta_query', array() ); 2350 2351 // Add our meta query to existing 2352 $meta_query[] = $forum_ids; 2353 2354 // Set the meta_query var 2355 $posts_query->set( 'meta_query', $meta_query ); 2343 // Excluding some forums 2344 if ( ! empty( $forum_ids ) ) { 2345 2346 // Get any existing meta queries 2347 $meta_query = (array) $posts_query->get( 'meta_query', array() ); 2348 2349 // Add our meta query to existing 2350 $meta_query[] = $forum_ids; 2351 2352 // Set the new meta_query val 2353 $posts_query->set( 'meta_query', $meta_query ); 2354 } 2356 2355 } 2357 2356 } -
trunk/src/includes/replies/functions.php
r7241 r7268 641 641 /** Reply Status **********************************************************/ 642 642 643 // Get available reply statuses 644 $reply_statuses = bbp_get_reply_statuses( $reply_id ); 645 643 646 // Use existing post_status 644 647 $reply_status = $reply->post_status; … … 647 650 if ( bbp_is_reply_public( $reply_id ) && ! bbp_check_for_moderation( $anonymous_data, $reply_author, $reply_title, $reply_content ) ) { 648 651 $reply_status = bbp_get_pending_status_id(); 652 653 // Check for possible posted reply status 654 } elseif ( ! empty( $_POST['bbp_reply_status'] ) && in_array( $_POST['bbp_reply_status'], array_keys( $reply_statuses ), true ) ) { 655 656 // Allow capable users to explicitly override the status 657 if ( current_user_can( 'moderate', $reply_id ) ) { 658 $reply_status = sanitize_key( $_POST['bbp_reply_status'] ); 659 660 // Not capable 661 } else { 662 bbp_add_error( 'bbp_edit_reply_status', __( '<strong>Error</strong>: You do not have permission to do that.', 'bbpress' ) ); 663 } 649 664 } 650 665 … … 2060 2075 * 2061 2076 * @param string $where 2077 * @param WP_Query $query 2062 2078 * @return string 2063 2079 */ -
trunk/src/includes/replies/template.php
r7248 r7268 800 800 * 801 801 * @param int $reply_id Optional. Reply id 802 * @return stringreply revisions802 * @return WP_Post[]|int[] reply revisions 803 803 */ 804 804 function bbp_get_reply_revisions( $reply_id = 0 ) { -
trunk/src/includes/search/template.php
r7175 r7268 47 47 } 48 48 49 // What are the default allowed statuses (based on user caps) 50 if ( bbp_get_view_all() ) { 51 52 // Default view=all statuses 53 $post_statuses = array_keys( bbp_get_topic_statuses() ); 54 55 // Add support for private status 56 if ( current_user_can( 'read_private_topics' ) ) { 57 $post_statuses[] = bbp_get_private_status_id(); 58 } 59 60 // Join post statuses together 61 $default['post_status'] = $post_statuses; 62 63 // Lean on the 'perm' query var value of 'readable' to provide statuses 64 } else { 65 $default['perm'] = 'readable'; 66 } 49 // Default public statuses (topics coincidentally cover all post types) 50 $post_statuses = array_keys( bbp_get_public_topic_statuses() ); 51 52 // Add support for private status 53 if ( current_user_can( 'read_private_topics' ) ) { 54 $post_statuses[] = bbp_get_private_status_id(); 55 } 56 57 // Add support for hidden status 58 if ( current_user_can( 'read_hidden_topics' ) ) { 59 $post_statuses[] = bbp_get_hidden_status_id(); 60 } 61 62 // Join post statuses together 63 $default['post_status'] = $post_statuses; 67 64 68 65 /** Setup *****************************************************************/ -
trunk/src/includes/topics/functions.php
r7207 r7268 580 580 581 581 // Maybe force into pending 582 if ( bbp_is_topic_public( $topic ->ID) && ! bbp_check_for_moderation( $anonymous_data, $topic_author, $topic_title, $topic_content ) ) {582 if ( bbp_is_topic_public( $topic_id ) && ! bbp_check_for_moderation( $anonymous_data, $topic_author, $topic_title, $topic_content ) ) { 583 583 $topic_status = bbp_get_pending_status_id(); 584 584 … … 587 587 588 588 // Allow capable users to explicitly override the status 589 if ( current_user_can( 'moderate', $ forum_id ) ) {589 if ( current_user_can( 'moderate', $topic_id ) ) { 590 590 $topic_status = sanitize_key( $_POST['bbp_topic_status'] ); 591 591 -
trunk/src/includes/topics/template.php
r7248 r7268 964 964 * 965 965 * @param int $topic_id Optional. Topic id 966 * @return stringTopic revisions966 * @return WP_Post[]|int[] Topic revisions 967 967 */ 968 968 function bbp_get_topic_revisions( $topic_id = 0 ) { -
trunk/src/readme.txt
r7232 r7268 5 5 License URI: https://www.gnu.org/licenses/gpl-2.0.html 6 6 Requires PHP: 5.6.20 7 Requires at least: 5.08 Tested up to: 5.97 Requires at least: 6.0 8 Tested up to: 6.5 9 9 Stable tag: 2.7.0-alpha-2 10 10 -
trunk/src/templates/default/bbpress/content-archive-topic.php
r6258 r7268 15 15 <div id="bbpress-forums" class="bbpress-wrapper"> 16 16 17 <?php if ( bbp_allow_search() ) : ?> 18 19 <div class="bbp-search-form"> 20 21 <?php bbp_get_template_part( 'form', 'search' ); ?> 22 23 </div> 24 25 <?php endif; ?> 17 <?php bbp_get_template_part( 'form', 'search' ); ?> 26 18 27 19 <?php bbp_breadcrumb(); ?> -
trunk/src/templates/default/bbpress/content-search.php
r7048 r7268 15 15 <div id="bbpress-forums" class="bbpress-wrapper"> 16 16 17 <?php bbp_get_template_part( 'form', 'search' ); ?> 18 17 19 <?php bbp_breadcrumb(); ?> 18 20 … … 29 31 <?php bbp_get_template_part( 'pagination', 'search' ); ?> 30 32 31 <?php else if ( bbp_get_search_terms() ): ?>33 <?php else : ?> 32 34 33 35 <?php bbp_get_template_part( 'feedback', 'no-search' ); ?> 34 35 <?php else : ?>36 37 <?php bbp_get_template_part( 'form', 'search' ); ?>38 36 39 37 <?php endif; ?> -
trunk/src/templates/default/bbpress/feedback-no-search.php
r6258 r7268 11 11 defined( 'ABSPATH' ) || exit; 12 12 13 ?>13 if ( bbp_get_search_terms() ) : ?> 14 14 15 15 <div class="bbp-template-notice"> … … 18 18 </ul> 19 19 </div> 20 21 <?php else : ?> 22 23 <div class="bbp-template-notice"> 24 <ul> 25 <li><?php esc_html_e( 'Please enter some search terms.', 'bbpress' ); ?></li> 26 </ul> 27 </div> 28 29 <?php endif; -
trunk/src/templates/default/bbpress/form-forum.php
r7006 r7268 85 85 <?php do_action( 'bbp_theme_after_forum_form_content' ); ?> 86 86 87 <?php if ( ! ( bbp_use_wp_editor() || current_user_can( 'unfiltered_html' ) ) ) : ?> 88 89 <p class="form-allowed-tags"> 90 <label><?php esc_html_e( 'You may use these <abbr title="HyperText Markup Language">HTML</abbr> tags and attributes:', 'bbpress' ); ?></label><br /> 91 <code><?php bbp_allowed_tags(); ?></code> 92 </p> 93 94 <?php endif; ?> 87 <?php bbp_get_template_part( 'form', 'allowed-tags' ); ?> 95 88 96 89 <?php if ( bbp_allow_forum_mods() && current_user_can( 'assign_moderators' ) ) : ?> -
trunk/src/templates/default/bbpress/form-reply.php
r7006 r7268 74 74 <?php do_action( 'bbp_theme_after_reply_form_content' ); ?> 75 75 76 <?php if ( ! ( bbp_use_wp_editor() || current_user_can( 'unfiltered_html' ) ) ) : ?> 77 78 <p class="form-allowed-tags"> 79 <label><?php esc_html_e( 'You may use these <abbr title="HyperText Markup Language">HTML</abbr> tags and attributes:', 'bbpress' ); ?></label><br /> 80 <code><?php bbp_allowed_tags(); ?></code> 81 </p> 82 83 <?php endif; ?> 76 <?php bbp_get_template_part( 'form', 'allowed-tags' ); ?> 84 77 85 78 <?php if ( bbp_allow_topic_tags() && current_user_can( 'assign_topic_tags', bbp_get_topic_id() ) ) : ?> -
trunk/src/templates/default/bbpress/form-topic.php
r6806 r7268 95 95 <?php do_action( 'bbp_theme_after_topic_form_content' ); ?> 96 96 97 <?php if ( ! ( bbp_use_wp_editor() || current_user_can( 'unfiltered_html' ) ) ) : ?> 98 99 <p class="form-allowed-tags"> 100 <label><?php printf( esc_html__( 'You may use these %s tags and attributes:', 'bbpress' ), '<abbr title="HyperText Markup Language">HTML</abbr>' ); ?></label><br /> 101 <code><?php bbp_allowed_tags(); ?></code> 102 </p> 103 104 <?php endif; ?> 97 <?php bbp_get_template_part( 'form', 'allowed-tags' ); ?> 105 98 106 99 <?php if ( bbp_allow_topic_tags() && current_user_can( 'assign_topic_tags', bbp_get_topic_id() ) ) : ?>
Note: See TracChangeset
for help on using the changeset viewer.