Skip to:
Content

bbPress.org

Changeset 4362


Ignore:
Timestamp:
11/08/2012 07:42:22 PM (14 years ago)
Author:
johnjamesjacoby
Message:

Topic Split:

  • When splitting a topic off into an existing topic, use the same kludge from topic-merge, and rejig the post_date by 1 second.
  • This keeps topics and replies in the correct order after splitting part of a topic, into another topic.
  • Props jmdodd.
  • Fixes #2015.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/includes/topics/functions.php

    r4331 r4362  
    14821482        do_action( 'bbp_pre_split_topic', $from_reply->ID, $source_topic->ID, $destination_topic->ID );
    14831483
     1484        /** Date Check ************************************************************/
     1485
     1486        // Check if the destination topic is older than the from reply
     1487        if ( strtotime( $from_reply->post_date ) < strtotime( $destination_topic->post_date ) ) {
     1488
     1489                // Set destination topic post_date to 1 second before from reply
     1490                $destination_post_date = date( 'Y-m-d H:i:s', strtotime( $from_reply->post_date ) - 1 );
     1491
     1492                $postarr = array(
     1493                        'ID'            => $destination_topic_id,
     1494                        'post_date'     => $destination_post_date,
     1495                        'post_date_gmt' => get_gmt_from_date( $destination_post_date )
     1496                );
     1497
     1498                // Update destination topic
     1499                wp_update_post( $postarr );
     1500        }
     1501
    14841502        /** Subscriptions *********************************************************/
    14851503
Note: See TracChangeset for help on using the changeset viewer.