Skip to:
Content

BuddyPress.org

Changeset 6591


Ignore:
Timestamp:
12/10/2012 10:25:25 AM (11 years ago)
Author:
johnjamesjacoby
Message:

Fix logic in get_activity_comments():

  • Use more accurate bounds when comparing mptt_left.
  • Fixes bug where activity comments would not appear on user profile pages where child comments exist in a hierarchical stream.
  • Fixes bug with spam SQL variable in same query.
  • Props sboisvert.
  • Fixes #4600.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-activity/bp-activity-classes.php

    r6574 r6591  
    500500
    501501            // Don't retrieve activity comments marked as spam
    502             if ( 'ham_only' == $spam )
     502            if ( 'ham_only' == $spam ) {
    503503                $spam_sql = 'AND a.is_spam = 0';
    504             elseif ( 'spam_only' == $spam )
     504            } elseif ( 'spam_only' == $spam ) {
    505505                $spam_sql = 'AND a.is_spam = 1';
    506             else
     506            } else {
    507507                $spam_sql = '';
     508            }
    508509
    509510            // The mptt BETWEEN clause allows us to limit returned descendants to the right part of the tree
    510             $sql = apply_filters( 'bp_activity_comments_user_join_filter', $wpdb->prepare( "SELECT a.*, u.user_email, u.user_nicename, u.user_login, u.display_name{$fullname_select} FROM {$bp->activity->table_name} a, {$wpdb->users} u{$fullname_from} WHERE u.ID = a.user_id {$fullname_where} AND a.type = 'activity_comment' ${spam_sql} AND a.item_id = %d AND a.mptt_left BETWEEN %d AND %d ORDER BY a.date_recorded ASC", $top_level_parent_id, $left, $right ), $activity_id, $left, $right, $spam_sql );
     511            $sql = apply_filters( 'bp_activity_comments_user_join_filter', $wpdb->prepare( "SELECT a.*, u.user_email, u.user_nicename, u.user_login, u.display_name{$fullname_select} FROM {$bp->activity->table_name} a, {$wpdb->users} u{$fullname_from} WHERE u.ID = a.user_id {$fullname_where} AND a.type = 'activity_comment' {$spam_sql} AND a.item_id = %d AND a.mptt_left > %d AND a.mptt_left < %d ORDER BY a.date_recorded ASC", $top_level_parent_id, $left, $right ), $activity_id, $left, $right, $spam_sql );
    511512
    512513            // Retrieve all descendants of the $root node
Note: See TracChangeset for help on using the changeset viewer.