Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
10/08/2015 04:59:40 PM (9 years ago)
Author:
boonebgorges
Message:

Introduce fields parameter to bp_has_activities() stack.

fields=ids will fetch only the IDs of matched activities. fields=all
(or any other value of fields, for the moment) will return full activity
objects.

The structure of the array returned from BP_Activity_Activity::get() is the
same regardless of the value of fields: matched items are stored in the
'activities' member of the returned array.

Props r-a-y.
Fixes #6426.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/testcases/activity/class.BP_Activity_Activity.php

    r9819 r10217  
    5353        $meta = bp_activity_get_meta( $activity, 'Paul' );
    5454        $this->assertSame( '', $meta );
     55    }
     56
     57    /**
     58     * @group get
     59     * @group fields
     60     * @ticket BP6426
     61     */
     62    public function test_get_with_fields_parameter_by_id() {
     63        $a = $this->factory->activity->create_many( 3, array(
     64            'type' => 'activity_update',
     65        ) );
     66
     67        $result = BP_Activity_Activity::get( array(
     68            'fields' => 'ids',
     69        ) );
     70        $this->assertEqualSets( $a, $result['activities'] );
    5571    }
    5672
Note: See TracChangeset for help on using the changeset viewer.