Skip to:
Content

bbPress.org


Ignore:
Timestamp:
05/21/2015 09:57:32 PM (10 years ago)
Author:
johnjamesjacoby
Message:

Inserts: When inserting a forum/topic/reply, immediately update the new object so hierarchy is refreshed.

This commit addresses the last active post ID being incorrect after inserting topics and replies to a forum, and fixes a failing test (in BBP_Tests_Core_Update::test_bbp_create_initial_content).

See #2805.

File:
1 edited

Legend:

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

    r5770 r5775  
    4343
    4444    // Insert reply
    45     $reply_id   = wp_insert_post( $reply_data );
     45    $reply_id = wp_insert_post( $reply_data );
    4646
    4747    // Bail if no reply was added
     
    5555        'forum_id'  => 0,
    5656        'topic_id'  => 0,
     57        'reply_to'  => 0
    5758    ), 'insert_reply_meta' );
    5859
     
    6263    }
    6364
    64     // Update the topic
    65     $topic_id = bbp_get_reply_topic_id( $reply_id );
    66     if ( !empty( $topic_id ) ) {
    67         bbp_update_topic( $topic_id );
    68     }
     65    // Update the reply and hierarchy
     66    bbp_update_reply( $reply_id, $reply_meta['topic_id'], $reply_meta['forum_id'], array(), $reply_data['post_author'], false, $reply_meta['reply_to'] );
    6967
    7068    // Return new reply ID
Note: See TracChangeset for help on using the changeset viewer.