Skip to:
Content

bbPress.org


Ignore:
Timestamp:
06/12/2017 02:10:58 PM (9 years ago)
Author:
johnjamesjacoby
Message:

Engagements: Tracking is not just for public or closed topics.

This commit updates the engagement upgrade tool and recalculation helper functions to not be limited to public & closed post statuses. Engagements can happen on private or hidden topics also, including trash, spam, and so on.

The non-visible topics that a user is engaged in should be filtered out as needed when queried based on post_status or other various meta-data.

See #3068.

File:
1 edited

Legend:

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

    r6522 r6525  
    196196        $topic_id = bbp_get_topic_id( $topic_id );
    197197        $bbp_db   = bbp_db();
    198         $statii   = "'" . implode( "', '", bbp_get_public_topic_statuses() ) . "'";
    199198
    200199        // A cool UNION query!
     
    202201SELECT DISTINCT( post_author ) FROM (
    203202        SELECT post_author FROM {$bbp_db->posts}
    204                 WHERE ( ID = %d AND post_status IN ({$statii}) AND post_type = %s )
     203                WHERE ( ID = %d AND post_type = %s )
    205204UNION
    206205        SELECT post_author FROM {$bbp_db->posts}
    207                 WHERE ( post_parent = %d AND post_status = %s AND post_type = %s )
     206                WHERE ( post_parent = %d AND post_type = %s )
    208207) as u1";
    209208
    210209        // Prepare & get results
    211         $query   = $bbp_db->prepare( $sql, $topic_id, bbp_get_topic_post_type(), $topic_id, bbp_get_public_status_id(), bbp_get_reply_post_type() );
     210        $query   = $bbp_db->prepare( $sql, $topic_id, bbp_get_topic_post_type(), $topic_id, bbp_get_reply_post_type() );
    212211        $results = $bbp_db->get_col( $query );
    213212
Note: See TracChangeset for help on using the changeset viewer.