Skip to:
Content

bbPress.org


Ignore:
Timestamp:
11/24/2019 04:49:50 AM (4 years ago)
Author:
johnjamesjacoby
Message:

Engagements: explicitly query for -1 posts if no objects are known to exist.

This commit fixes an issue with the 2.5 User Engagements strategy that will cause all topics to be queried instead of none of them.

Revert r7002 and use a different syntax to avoid debug notices.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/includes/common/engagements.php

    r7002 r7005  
    945945        $object_ids = $this->parse_comma_list( get_user_option( $option_key, $user_id ) );
    946946
     947        // Maybe trick WP_Query into ".ID IN ()"
     948        if ( empty( $object_ids ) ) {
     949            $object_ids = array( 0 );
     950        }
     951
    947952        // Maybe include these post IDs
    948         if ( ! empty( $object_ids ) ) {
    949             $args = array(
    950                 'post__in' => $object_ids
    951             );
    952 
    953         // Or maybe include nothing
    954         } else {
    955             $args = array(
    956                 'post__in' => -1 // Tricks WP_Query into ".ID IN ()"
    957             );
    958         }
     953        $args = array(
     954            'post__in' => $object_ids
     955        );
    959956
    960957        // Parse arguments
Note: See TracChangeset for help on using the changeset viewer.