Ticket #2588: 2588.2.diff
File 2588.2.diff, 1.9 KB (added by , 11 years ago) |
---|
-
src/includes/admin/tools.php
641 641 if ( is_wp_error( $wpdb->query( $sql_delete ) ) ) { 642 642 return array( 1, sprintf( $statement, $result ) ); 643 643 } 644 644 645 645 // Recalculate the metas key _bbp_reply_count and _bbp_total_reply_count for each forum 646 646 $forums = get_posts( array( 'post_type' => bbp_get_forum_post_type(), 'numberposts' => -1 ) ); 647 647 if ( !empty( $forums ) ) { … … 1322 1322 $statement = __( 'Recalculating reply menu order … %s', 'bbpress' ); 1323 1323 $result = __( 'No reply hierachy to recalculate!', 'bbpress' ); 1324 1324 1325 // First, delete _bbp_reply_to to self from post meta. 1326 if ( is_wp_error( $wpdb->query( "DELETE FROM `$wpdb->postmeta` WHERE `meta_key` = '_bbp_reply_to' AND `post_id` = `meta_value`;" ) ) ) 1327 return array( 1, sprintf( $statement, $result ) ); 1328 1325 1329 // Post type 1326 1330 $rpt = bbp_get_reply_post_type(); 1327 1331 … … 1339 1343 1340 1344 // Bail if no replies returned 1341 1345 if ( empty( $replies ) ) { 1342 return array( 1, sprintf( $statement, $result ) );1346 return array( 2, sprintf( $statement, $result ) ); 1343 1347 } 1344 1348 1345 1349 // Recalculate the menu order position for each reply -
src/includes/replies/functions.php
1119 1119 return; 1120 1120 1121 1121 // Set the reply to 1122 if ( ! empty( $reply_to ) ) {1122 if ( ! empty( $reply_to ) ) { 1123 1123 update_post_meta( $reply_id, '_bbp_reply_to', $reply_to ); 1124 1124 1125 1125 // Delete the reply to … … 1127 1127 delete_post_meta( $reply_id, '_bbp_reply_to' ); 1128 1128 } 1129 1129 1130 return (int) apply_filters( 'bbp_update_reply_to', (int) $reply_ to, $reply_id);1130 return (int) apply_filters( 'bbp_update_reply_to', (int) $reply_id, $reply_to ); 1131 1131 } 1132 1132 1133 1133 /**