Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
10/08/2015 04:59:40 PM (10 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/src/bp-activity/bp-activity-template.php

    r10160 r10217  
    271271            'page_arg'          => 'acpage',
    272272            'max'               => false,
     273            'fields'            => 'all',
    273274            'count_total'       => false,
    274275            'sort'              => false,
     
    508509 *
    509510 * @since 1.0.0
     511 * @since 2.4.0 Introduced the `$fields` parameter.
    510512 *
    511513 * @global object $activities_template {@link BP_Activity_Template}
     
    537539 *     @type string            $page_arg         String used as a query parameter in pagination links. Default: 'acpage'.
    538540 *     @type int|bool          $max              Maximum number of results to return. Default: false (unlimited).
     541 *     @type string            $fields           Activity fields to retrieve. 'all' to fetch entire activity objects,
     542 *                                               'ids' to get only the activity IDs. Default 'all'.
    539543 *     @type string|bool       $count_total      If true, an additional DB query is run to count the total activity items
    540544 *                                               for the query. Default: false.
     
    662666        'page_arg'          => 'acpage',     // See https://buddypress.trac.wordpress.org/ticket/3679
    663667        'max'               => false,        // max number to return
     668        'fields'            => 'all',
    664669        'count_total'       => false,
    665670        'show_hidden'       => $show_hidden, // Show activity items that are hidden site-wide?
Note: See TracChangeset for help on using the changeset viewer.