Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
01/19/2015 06:14:47 PM (10 years ago)
Author:
johnjamesjacoby
Message:

Revert r9330 in lieu of original patch on #6099.

When querying for various types and scopes of activity stream items, each BuddyPress component having a unique type or scope also has unique keys and filters responsible for handling the custom queries necessary to get the correct entries from the database.

In some instances (like single groups, member favorites, etc...) these scopes are returning invalid (or empty) results, causing no activity entries to be returned from the database when entries do exist and should be displayed.

Unit tests still apply (though they get some variable clean-up here.)

Hat-tip hnla for discovery. Props r-a-y, imath. Fixes #6140. Fixes #6099.

File:
1 edited

Legend:

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

    r9366 r9372  
    319319        }
    320320
    321         $defaults = array(
     321        $r = wp_parse_args( $args, array(
    322322            'page'              => 1,          // The current page
    323323            'per_page'          => 25,         // Activity items per page
     
    337337            'update_meta_cache' => true,
    338338            'count_total'       => false,
    339         );
    340         $r = wp_parse_args( $args, $defaults );
     339        ) );
    341340
    342341        // Select conditions
     
    360359            if ( ! empty( $scope_query['sql'] ) ) {
    361360                $where_conditions['scope_query_sql'] = $scope_query['sql'];
    362 
    363             // No matches, so we should alter the SQL statement to match nothing
    364             } else {
    365                 $where_conditions['scope_no_results'] = '0 = 1';
    366361            }
    367362
     
    370365                $r = self::array_replace_recursive( $r, $scope_query['override'] );
    371366            }
     367
    372368        // Advanced filtering
    373369        } elseif ( ! empty( $r['filter_query'] ) ) {
    374370            $filter_query = new BP_Activity_Query( $r['filter_query'] );
    375             if ( $sql = $filter_query->get_sql() ) {
     371            $sql          = $filter_query->get_sql();
     372            if ( ! empty( $sql ) ) {
    376373                $where_conditions['filter_query_sql'] = $sql;
    377374            }
     
    403400
    404401        // Hide Hidden Items?
    405         if ( ! $r['show_hidden'] )
     402        if ( ! $r['show_hidden'] ) {
    406403            $where_conditions['hidden_sql'] = "a.hide_sitewide = 0";
     404        }
    407405
    408406        // Exclude specified items
     
    616614
    617615            if ( !empty( $r['max'] ) ) {
    618                 if ( (int) $total_activities > (int) $r['max'] )
     616                if ( (int) $total_activities > (int) $r['max'] ) {
    619617                    $total_activities = $r['max'];
     618                }
    620619            }
    621620
Note: See TracChangeset for help on using the changeset viewer.