Making WordPress.org

Changeset 5693


Ignore:
Timestamp:
07/19/2017 12:30:56 AM (7 years ago)
Author:
SergeyBiryukov
Message:

Support Forums: Update the necessary meta data when editing a reply created before 2017-07-17, as those replies can have potentially inaccurate data.

See #2110, #2481.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/support-forums/inc/class-dropin.php

    r5675 r5693  
    3535
    3636        add_action( 'bbp_edit_topic',          array( $this, 'update_old_topic_meta' ) );
     37        add_action( 'bbp_edit_reply',          array( $this, 'update_old_reply_meta' ) );
    3738
    3839        // Avoid bbp_update_topic_walker().
     
    133134        bbp_update_topic_reply_count( $topic_id );
    134135        $this->bbp_update_topic_reply_count_hidden( $topic_id );
     136    }
     137
     138    /**
     139     * Update the necessary meta data when editing a reply created before
     140     * 2017-07-17, as those replies can have potentially inaccurate data.
     141     *
     142     * @see https://meta.trac.wordpress.org/ticket/2110
     143     * @see https://meta.trac.wordpress.org/ticket/2481
     144     *
     145     * @param int $reply_id Reply ID.
     146     */
     147    function update_old_reply_meta( $reply_id ) {
     148        // Only run on topics older than 2017-07-17.
     149        if ( get_post_field( 'post_date', $reply_id ) >= '2017-07-17' ) {
     150            return;
     151        }
     152
     153        bbp_update_reply_position( $reply_id );
    135154    }
    136155
Note: See TracChangeset for help on using the changeset viewer.