Changeset 7263
- Timestamp:
- 06/28/2024 06:52:31 PM (22 months ago)
- File:
-
- 1 edited
-
branches/2.6/src/includes/admin/tools/repair.php (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/2.6/src/includes/admin/tools/repair.php
r7135 r7263 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 ) );
Note: See TracChangeset
for help on using the changeset viewer.