Skip to:
Content

bbPress.org


Ignore:
Timestamp:
09/07/2016 12:16:39 PM (3 years ago)
Author:
netweb
Message:

Tools: Running the "Reset Forums" tool now deletes bbPress' custom post type revisions from the database.

This changeset adds support for deleting forum, topic, and reply post types revisions to bbp_admin_reset_handler().

Fixes #2945.

File:
1 edited

Legend:

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

    r6002 r6091  
    22552255    }
    22562256
     2257    /** Post Revisions ********************************************************/
     2258
     2259    if ( ! empty( $sql_posts ) ) {
     2260        $sql_meta = array();
     2261        foreach ( $sql_posts as $key => $value ) {
     2262            $sql_meta[] = $key;
     2263        }
     2264        $statement  = __( 'Deleting Post Revisions… %s', 'bbpress' );
     2265        $sql_meta   = implode( "', '", $sql_meta );
     2266        $sql_delete = "DELETE FROM `{$bbp_db->posts}` WHERE `post_parent` IN ('{$sql_meta}') AND `post_type` = 'revision';";
     2267        $result     = is_wp_error( $bbp_db->query( $sql_delete ) ) ? $failed : $success;
     2268        $messages[] = sprintf( $statement, $result );
     2269    }
     2270
    22572271    /** Forum moderators ******************************************************/
    22582272
Note: See TracChangeset for help on using the changeset viewer.