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/admin/tools/upgrade.php

    r6523 r6525  
    178178        $tpt = bbp_get_topic_post_type();
    179179        $rpt = bbp_get_reply_post_type();
    180         $pps = bbp_get_public_status_id();
    181         $cps = bbp_get_closed_status_id();
    182         $sql = $bbp_db->prepare( "INSERT INTO {$bbp_db->postmeta} (post_id, meta_key, meta_value) (
     180        $sql = "INSERT INTO {$bbp_db->postmeta} (post_id, meta_key, meta_value) (
    183181                        SELECT postmeta.meta_value, '_bbp_engagement', posts.post_author
    184182                                FROM {$bbp_db->posts} AS posts
     
    187185                                        AND postmeta.meta_key = '_bbp_topic_id'
    188186                                WHERE posts.post_type IN (%s, %s)
    189                                         AND posts.post_status IN (%s, %s)
    190                                 GROUP BY postmeta.meta_value, posts.post_author)", $tpt, $rpt, $pps, $cps );
     187                                GROUP BY postmeta.meta_value, posts.post_author)";
    191188
    192189        // Run the big query
    193         $prepare     = $bbp_db->prepare( $sql, $tpt, $rpt, $pps, $cps );
     190        $prepare     = $bbp_db->prepare( $sql, $tpt, $rpt );
    194191        $engagements = $bbp_db->query( $prepare );
    195192
Note: See TracChangeset for help on using the changeset viewer.