Changeset 4096
- Timestamp:
- 07/20/2012 02:33:10 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2.1/bbp-includes/bbp-topic-functions.php
r4059 r4096 1442 1442 } 1443 1443 1444 // Bail i rthere are errors1444 // Bail if there are errors 1445 1445 if ( bbp_has_errors() ) 1446 1446 return; … … 1507 1507 if ( !empty( $replies ) && !is_wp_error( $replies ) ) { 1508 1508 1509 // Calculate starting point for reply positions 1510 switch ( $split_option ) { 1511 1512 // Get topic reply count for existing topic 1513 case 'existing' : 1514 $reply_position = bbp_get_topic_reply_count( $destination_topic->ID ); 1515 break; 1516 1517 // Account for new lead topic 1518 case 'reply' : 1519 $reply_position = 1; 1520 break; 1521 } 1522 1509 1523 // Change the post_parent of each reply to the destination topic id 1510 1524 foreach ( $replies as $reply ) { 1511 1525 1526 // Bump the reply position each iteration through the loop 1527 $reply_position++; 1528 1512 1529 // New reply data 1513 1530 $postarr = array( 1514 'ID' => $reply->ID, 1515 'post_title' => sprintf( __( 'Reply To: %s', 'bbpress' ), $destination_topic->post_title ), 1516 'post_name' => false, // will be automatically generated 1517 'post_parent' => $destination_topic->ID, 1518 'guid' => '' 1531 'ID' => $reply->ID, 1532 'post_title' => sprintf( __( 'Reply To: %s', 'bbpress' ), $destination_topic->post_title ), 1533 'post_name' => false, // will be automatically generated 1534 'post_parent' => $destination_topic->ID, 1535 'post_position' => $reply_position, 1536 'guid' => '' 1519 1537 ); 1520 1538 … … 1529 1547 do_action( 'bbp_split_topic_reply', $reply->ID, $destination_topic->ID ); 1530 1548 } 1549 1550 // Set the last reply ID and freshness 1551 $last_reply_id = $reply->ID; 1552 $freshness = $reply->post_date; 1553 1554 // Set the last reply ID and freshness to the from_reply 1555 } else { 1556 $last_reply_id = $from_reply->ID; 1557 $freshness = $from_reply->post_date; 1531 1558 } 1532 1559 … … 1534 1561 // the topic display in bbp_has_topics() list 1535 1562 if ( 'reply' == $split_option ) { 1536 $last_reply_id = ( empty( $reply ) || empty( $reply->ID ) ) ? 0 : $reply->ID;1537 $freshness = ( empty( $reply ) || empty( $reply->post_date ) ) ? '' : $reply->post_date;1538 1539 1563 bbp_update_topic_last_reply_id ( $destination_topic->ID, $last_reply_id ); 1564 bbp_update_topic_last_active_id ( $destination_topic->ID, $last_reply_id ); 1540 1565 bbp_update_topic_last_active_time( $destination_topic->ID, $freshness ); 1541 1566 } 1542 1567 1568 // Update source topic ID last active 1569 bbp_update_topic_last_reply_id ( $source_topic->ID ); 1570 bbp_update_topic_last_active_id ( $source_topic->ID ); 1571 bbp_update_topic_last_active_time( $source_topic->ID ); 1572 1543 1573 /** Successful Split ******************************************************/ 1544 1574
Note: See TracChangeset
for help on using the changeset viewer.