Ticket #2528: 2528.2.diff
File 2528.2.diff, 2.4 KB (added by , 10 years ago) |
---|
-
src/includes/topics/functions.php
1220 1220 /** Date Check ************************************************************/ 1221 1221 1222 1222 // Check if the destination topic is older than the source topic 1223 if ( strtotime( $ destination_topic->post_date ) < strtotime( $source_topic->post_date ) ) {1223 if ( strtotime( $source_topic->post_date ) < strtotime( $destination_topic->post_date ) ) { 1224 1224 1225 1225 // Set destination topic post_date to 1 second before source topic 1226 1226 $destination_post_date = date( 'Y-m-d H:i:s', strtotime( $source_topic->post_date ) - 1 ); … … 1300 1300 // Sticky 1301 1301 bbp_unstick_topic( $source_topic->ID ); 1302 1302 1303 // Delete source topic's last and count meta data 1304 delete_post_meta( $source_topic->ID, '_bbp_last_reply_id' ); 1305 delete_post_meta( $source_topic->ID, '_bbp_last_active_id' ); 1306 delete_post_meta( $source_topic->ID, '_bbp_last_active_time' ); 1307 delete_post_meta( $source_topic->ID, '_bbp_voice_count' ); 1308 delete_post_meta( $source_topic->ID, '_bbp_reply_count' ); 1309 delete_post_meta( $source_topic->ID, '_bbp_reply_count_hidden' ); 1310 1303 1311 // Get the replies of the source topic 1304 1312 $replies = (array) get_posts( array( 1305 1313 'post_parent' => $source_topic->ID, … … 1321 1329 // Update the reply 1322 1330 wp_update_post( array( 1323 1331 'ID' => $reply->ID, 1324 'post_title' => sprintf( __( 'Reply To: %s', 'bbpress' ), $destination_topic->post_title ),1325 'post_name' => false,1332 'post_title' => '', 1333 'post_name' => $reply->ID, 1326 1334 'post_type' => bbp_get_reply_post_type(), 1327 1335 'post_parent' => $destination_topic->ID, 1328 'menu_order' => bbp_get_reply_position_raw( $reply->ID, $destination_topic->ID ),1329 1336 'guid' => '' 1330 1337 ) ); 1331 1338 … … 1333 1340 bbp_update_reply_topic_id( $reply->ID, $destination_topic->ID ); 1334 1341 bbp_update_reply_forum_id( $reply->ID, bbp_get_topic_forum_id( $destination_topic->ID ) ); 1335 1342 1336 // Adjust reply to values 1337 $reply_to = bbp_get_reply_to( $reply->ID ); 1338 if ( empty( $reply_to ) ) { 1339 bbp_update_reply_to( $reply->ID, $source_topic->ID ); 1340 } 1343 // Update the reply position 1344 bbp_update_reply_position( $reply->ID ); 1341 1345 1342 1346 // Do additional actions per merged reply 1343 1347 do_action( 'bbp_merged_topic_reply', $reply->ID, $destination_topic->ID );