Skip to:
Content

bbPress.org


Ignore:
Timestamp:
05/21/2015 09:57:32 PM (12 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/topics/functions.php

    r5770 r5775  
    4343
    4444        // Insert topic
    45         $topic_id   = wp_insert_post( $topic_data );
     45        $topic_id = wp_insert_post( $topic_data );
    4646
    4747        // Bail if no topic was added
    … …  
    6868        }
    6969
    70         // Update the forum
    71         $forum_id = bbp_get_topic_forum_id( $topic_id );
    72         if ( ! empty( $forum_id ) ) {
    73                 bbp_update_forum( array( 'forum_id' => $forum_id ) );
    74         }
     70        // Update the topic and hierarchy
     71        bbp_update_topic( $topic_id, $topic_meta['forum_id'], array(), $topic_data['author_id'], false );
    7572
    7673        // Return new topic ID
Note: See TracChangeset for help on using the changeset viewer.