Skip to:
Content

bbPress.org


Ignore:
Timestamp:
09/21/2021 01:08:32 AM (3 years ago)
Author:
johnjamesjacoby
Message:

Content: add post_parent to forum & topic duplicate checks.

This change limits the scope of "duplicate content" to its parent context, meaning that replies must be to the same topic, topics must be in the same forum, and forums must be in the same sub-forum (or root) to be considered a duplicate.

This better implements the spirit of this feature which is to prevent accidental/unintended duplicates, and is not intended to simply prevent globally similar content by the same author.

Props r-a-y, johnjamesjacoby.

In trunk, for 2.7.0.

See #3418.

File:
1 edited

Legend:

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

    r7191 r7207  
    307307    /** Reply Duplicate *******************************************************/
    308308
    309     if ( ! bbp_check_for_duplicate( array( 'post_type' => bbp_get_reply_post_type(), 'post_author' => $reply_author, 'post_content' => $reply_content, 'post_parent' => $topic_id, 'anonymous_data' => $anonymous_data ) ) ) {
     309    $dupe_args = array(
     310        'post_type'      => bbp_get_reply_post_type(),
     311        'post_author'    => $reply_author,
     312        'post_content'   => $reply_content,
     313        'post_parent'    => $topic_id,
     314        'anonymous_data' => $anonymous_data
     315    );
     316
     317    if ( ! bbp_check_for_duplicate( $dupe_args ) ) {
    310318        bbp_add_error( 'bbp_reply_duplicate', __( '<strong>Error</strong>: Duplicate reply detected; it looks as though you&#8217;ve already said that.', 'bbpress' ) );
    311319    }
Note: See TracChangeset for help on using the changeset viewer.