Skip to:
Content

bbPress.org

Changeset 5656


Ignore:
Timestamp:
03/24/2015 09:15:40 AM (7 years ago)
Author:
netweb
Message:

Don't create post revisions when opening topics in bbp_open_topic() or closing topics in bbp_close_topic() as post content does not change.

Props netweb. See #2653

File:
1 edited

Legend:

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

    r5637 r5656  
    27922792    $topic->post_status = bbp_get_closed_status_id();
    27932793
    2794     // No revisions
    2795     remove_action( 'pre_post_update', 'wp_save_post_revision' );
     2794    // Toggle revisions off as we are not altering content
     2795    if ( post_type_supports( bbp_get_topic_post_type(), 'revisions' ) ) {
     2796        $revisions_removed = true;
     2797        remove_post_type_support( bbp_get_topic_post_type(), 'revisions' );
     2798    }
    27962799
    27972800    // Update topic
    27982801    $topic_id = wp_update_post( $topic );
     2802
     2803    // Toggle revisions back on
     2804    if ( true === $revisions_removed ) {
     2805        $revisions_removed = false;
     2806        add_post_type_support( bbp_get_topic_post_type(), 'revisions' );
     2807    }
    27992808
    28002809    // Execute post close code
     
    28492858    delete_post_meta( $topic_id, '_bbp_status' );
    28502859
    2851     // No revisions
    2852     remove_action( 'pre_post_update', 'wp_save_post_revision' );
     2860    // Toggle revisions off as we are not altering content
     2861    if ( post_type_supports( bbp_get_topic_post_type(), 'revisions' ) ) {
     2862        $revisions_removed = true;
     2863        remove_post_type_support( bbp_get_topic_post_type(), 'revisions' );
     2864    }
    28532865
    28542866    // Update topic
    28552867    $topic_id = wp_update_post( $topic );
     2868
     2869    // Toggle revisions back on
     2870    if ( true === $revisions_removed ) {
     2871        $revisions_removed = false;
     2872        add_post_type_support( bbp_get_topic_post_type(), 'revisions' );
     2873    }
    28562874
    28572875    // Execute post open code
Note: See TracChangeset for help on using the changeset viewer.