Skip to:
Content

bbPress.org

Ticket #3310: repair.php.patch

File repair.php.patch, 1.2 KB (added by ikovalyov, 3 years ago)
  • repair.php

     
    11631163        // Post types and status
    11641164        $tpt = bbp_get_topic_post_type();
    11651165        $rpt = bbp_get_reply_post_type();
     1166        $fmt = bbp_get_forum_post_type();
    11661167
    11671168        // Next, give all the topics their parent forum id.
    11681169        if ( is_wp_error( $bbp_db->query( "INSERT INTO `{$bbp_db->postmeta}` (`post_id`, `meta_key`, `meta_value`)
     
    11741175                return array( 2, sprintf( $statement, $result ) );
    11751176        }
    11761177
     1178    // Next, give all the topics their parent forum id.
     1179    if ( is_wp_error( $bbp_db->query( "INSERT INTO `{$bbp_db->postmeta}` (`post_id`, `meta_key`, `meta_value`)
     1180                        ( SELECT `topic`.`ID`, '_bbp_forum_id', `topic`.`post_parent`
     1181                        FROM `$bbp_db->posts`
     1182                                AS `topic`
     1183                        WHERE `topic`.`post_type` = '{$fmt}'
     1184                        GROUP BY `topic`.`ID` )" ) ) ) {
     1185        return array( 2, sprintf( $statement, $result ) );
     1186    }
     1187
    11771188        // Next, give all the replies their parent forum id.
    11781189        if ( is_wp_error( $bbp_db->query( "INSERT INTO `{$bbp_db->postmeta}` (`post_id`, `meta_key`, `meta_value`)
    11791190                        ( SELECT `reply`.`ID`, '_bbp_forum_id', `topic`.`post_parent`