Skip to:
Content

bbPress.org

Changeset 5491


Ignore:
Timestamp:
09/10/2014 11:03:48 PM (11 years ago)
Author:
johnjamesjacoby
Message:

In bbp_split_topic_handler() remove $reply_position cheater code, and rely on bbp_update_reply_position() to recalculate the correct position in the hierarchy after wp_update_post() has finished. Props netweb. Fixes #2624.

File:
1 edited

Legend:

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

    r5490 r5491  
    16691669    if ( ! empty( $replies ) && ! is_wp_error( $replies ) ) {
    16701670
    1671         // Calculate starting point for reply positions
    1672         switch ( $split_option ) {
    1673 
    1674             // Get topic reply count for existing topic
    1675             case 'existing' :
    1676                 $reply_position = bbp_get_topic_reply_count( $destination_topic->ID, true );
    1677                 break;
    1678 
    1679             // Account for new lead topic
    1680             case 'reply'    :
    1681                 $reply_position = 1;
    1682                 break;
    1683         }
    1684 
    16851671        // Save reply ids
    16861672        $reply_ids = array();
     
    16881674        // Change the post_parent of each reply to the destination topic id
    16891675        foreach ( $replies as $reply ) {
    1690 
    1691             // Bump the reply position each iteration through the loop
    1692             $reply_position++;
    16931676
    16941677            // Update the reply
     
    16981681                'post_name'   => false, // will be automatically generated
    16991682                'post_parent' => $destination_topic->ID,
    1700                 'menu_order'  => $reply_position,
    17011683                'guid'        => ''
    17021684            ) );
     
    17081690            bbp_update_reply_topic_id( $reply->ID, $destination_topic->ID                           );
    17091691            bbp_update_reply_forum_id( $reply->ID, bbp_get_topic_forum_id( $destination_topic->ID ) );
     1692
     1693            // Adjust reply position
     1694            bbp_update_reply_position( $reply->ID );
    17101695
    17111696            // Adjust reply to values
Note: See TracChangeset for help on using the changeset viewer.