Skip to:
Content

BuddyPress.org

Changeset 9372


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.

Location:
trunk
Files:
5 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
  • trunk/src/bp-activity/bp-activity-filters.php

    r9351 r9372  
    678678    $favs = bp_activity_get_user_favorites( $filter['user_id'] );
    679679    if ( empty( $favs ) ) {
    680         return $retval;
     680        $favs = array( 0 );
    681681    }
    682682
  • trunk/src/bp-friends/bp-friends-activity.php

    r9351 r9372  
    243243
    244244    if ( empty( $friends ) ) {
    245         return $retval;
     245        $friends = array( 0 );
    246246    }
    247247
  • trunk/src/bp-groups/bp-groups-activity.php

    r9351 r9372  
    247247
    248248    if ( empty( $groups['groups'] ) ) {
    249         return $retval;
     249        $groups = array( 'groups' => 0 );
    250250    }
    251251
  • trunk/tests/phpunit/testcases/activity/template.php

    r9330 r9372  
    353353
    354354        // Create a random activity
    355         $a1 = $this->factory->activity->create( array(
     355        $this->factory->activity->create( array(
    356356            'user_id' => $u1,
    357357            'type' => 'activity_update',
     
    386386
    387387        // Create a random activity
    388         $a1 = $this->factory->activity->create( array(
     388        $this->factory->activity->create( array(
    389389            'user_id' => $u1,
    390390            'type' => 'activity_update',
     
    419419
    420420        // Create a random activity
    421         $a1 = $this->factory->activity->create( array(
     421        $this->factory->activity->create( array(
    422422            'user_id' => $u1,
    423423            'type' => 'activity_update',
     
    452452
    453453        // Create a random activity
    454         $a1 = $this->factory->activity->create( array(
     454        $this->factory->activity->create( array(
    455455            'user_id' => $u1,
    456456            'type' => 'activity_update',
Note: See TracChangeset for help on using the changeset viewer.