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/forums/functions.php

    r7191 r7207  
    231231    /** Forum Duplicate *******************************************************/
    232232
    233     if ( ! bbp_check_for_duplicate( array( 'post_type' => bbp_get_forum_post_type(), 'post_author' => $forum_author, 'post_content' => $forum_content, 'anonymous_data' => $anonymous_data ) ) ) {
     233    $dupe_args = array(
     234        'post_type'      => bbp_get_forum_post_type(),
     235        'post_author'    => $forum_author,
     236        'post_content'   => $forum_content,
     237        'post_parent'    => $forum_parent_id,
     238        'anonymous_data' => $anonymous_data
     239    );
     240
     241    if ( ! bbp_check_for_duplicate( $dupe_args ) ) {
    234242        bbp_add_error( 'bbp_forum_duplicate', __( '<strong>Error</strong>: This forum already exists.', 'bbpress' ) );
    235243    }
Note: See TracChangeset for help on using the changeset viewer.