Skip to:
Content

bbPress.org

Changeset 7134


Ignore:
Timestamp:
08/14/2020 05:47:59 PM (17 months ago)
Author:
johnjamesjacoby
Message:

Repair Tools: rebuild forum forum IDs.

This commit adds back the _bbp_forum_id meta data for Forums that was previously deleted inside the bbp_admin_repair_forum_meta() repair function.

Props ikovalyov.

In trunk, for 2.7.

See #3310.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/includes/admin/tools/repair.php

    r7006 r7134  
    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.
     
    11721173            WHERE `topic`.`post_type` = '{$tpt}'
    11731174            GROUP BY `topic`.`ID` )" ) ) ) {
     1175        return array( 2, sprintf( $statement, $result ) );
     1176    }
     1177
     1178    // Next, give all the forums 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 `forum`.`ID`, '_bbp_forum_id', `forum`.`post_parent`
     1181            FROM `$bbp_db->posts`
     1182                AS `forum`
     1183            WHERE `forum`.`post_type` = '{$fmt}'
     1184            GROUP BY `forum`.`ID` )" ) ) ) {
    11741185        return array( 2, sprintf( $statement, $result ) );
    11751186    }
Note: See TracChangeset for help on using the changeset viewer.