Skip to:
Content

bbPress.org

Changeset 3124


Ignore:
Timestamp:
05/09/2011 05:39:31 AM (15 years ago)
Author:
johnjamesjacoby
Message:

Fix bug in topic/reply revisions where log was 1 revision behind.

Location:
branches/plugin/bbp-includes
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/plugin/bbp-includes/bbp-reply-functions.php

    r3120 r3124  
    326326        if ( !is_wp_error( $bbp->errors ) || !$bbp->errors->get_error_codes() ) {
    327327
    328             $reply_edit_reason = !empty( $_POST['bbp_reply_edit_reason'] ) ? esc_attr( strip_tags( $_POST['bbp_reply_edit_reason'] ) ) : '';
    329 
    330             if ( !empty( $_POST['bbp_log_reply_edit'] ) && 1 == $_POST['bbp_log_reply_edit'] && $revision_id = wp_save_post_revision( $reply_id ) )
    331                 bbp_update_reply_revision_log( array( 'reply_id' => $reply_id, 'revision_id' => $revision_id, 'author_id' => bbp_get_current_user_id(), 'reason' => $reply_edit_reason ) );
    332 
    333328            // Add the content of the form to $post as an array
    334329            $reply_data = array(
     
    340335            // Insert reply
    341336            $reply_id = wp_update_post( $reply_data );
     337
     338            // Revisions
     339            $reply_edit_reason = !empty( $_POST['bbp_reply_edit_reason'] ) ? esc_attr( strip_tags( $_POST['bbp_reply_edit_reason'] ) ) : '';
     340
     341            if ( !empty( $_POST['bbp_log_reply_edit'] ) && 1 == $_POST['bbp_log_reply_edit'] && $revision_id = wp_save_post_revision( $reply_id ) )
     342                bbp_update_reply_revision_log( array( 'reply_id' => $reply_id, 'revision_id' => $revision_id, 'author_id' => bbp_get_current_user_id(), 'reason' => $reply_edit_reason ) );
    342343
    343344            // Check for missing reply_id or error
  • branches/plugin/bbp-includes/bbp-topic-functions.php

    r3120 r3124  
    308308        if ( !is_wp_error( $bbp->errors ) || !$bbp->errors->get_error_codes() ) {
    309309
    310             $topic_edit_reason = !empty( $_POST['bbp_topic_edit_reason'] ) ? esc_attr( strip_tags( $_POST['bbp_topic_edit_reason'] ) ) : '';
    311 
    312             if ( !empty( $_POST['bbp_log_topic_edit'] ) && 1 == $_POST['bbp_log_topic_edit'] && $revision_id = wp_save_post_revision( $topic_id ) )
    313                 bbp_update_topic_revision_log( array( 'topic_id' => $topic_id, 'revision_id' => $revision_id, 'author_id' => bbp_get_current_user_id(), 'reason' => $topic_edit_reason ) );
    314 
    315310            // Stick status
    316311            if ( !empty( $_POST['bbp_stick_topic'] ) && in_array( $_POST['bbp_stick_topic'], array( 'stick', 'super', 'unstick' ) ) ) {
     
    343338            // Insert topic
    344339            $topic_id = wp_update_post( $topic_data );
     340
     341            // Revisions
     342            $topic_edit_reason = !empty( $_POST['bbp_topic_edit_reason'] ) ? esc_attr( strip_tags( $_POST['bbp_topic_edit_reason'] ) ) : '';
     343
     344            if ( !empty( $_POST['bbp_log_topic_edit'] ) && 1 == $_POST['bbp_log_topic_edit'] && $revision_id = wp_save_post_revision( $topic_id ) )
     345                bbp_update_topic_revision_log( array( 'topic_id' => $topic_id, 'revision_id' => $revision_id, 'author_id' => bbp_get_current_user_id(), 'reason' => $topic_edit_reason ) );
    345346
    346347            // Check for missing topic_id or error
Note: See TracChangeset for help on using the changeset viewer.