[buddypress-trac] [BuddyPress Trac] #6426: 'fields' => 'ids' for activity queries

buddypress-trac noreply at wordpress.org
Tue Aug 18 19:49:46 UTC 2015


#6426: 'fields' => 'ids' for activity queries
----------------------------------+------------------
 Reporter:  boonebgorges          |       Owner:
     Type:  enhancement           |      Status:  new
 Priority:  normal                |   Milestone:  2.4
Component:  Component - Activity  |     Version:
 Severity:  normal                |  Resolution:
 Keywords:  has-patch             |
----------------------------------+------------------

Comment (by r-a-y):

 > I think that we should *not* bypass pagination in the case of
 fields=ids. If for no other reason than parity with WP_Query.

 If we do not bypass pagination, I think we'll need to add back the
 `'has_more_items'` marker, so developers know there might be more items.

 If this is the case, should the return array be:



 {{{
 Array(
     [0] => 1,
     ...
     ['has_more_items'] => false
 )

 }}}

 Or:


 {{{

 Array(
     ['activities'] => array(
          [0] => 1,
          ...
     )
     ['has_more_items'] => false
 )
 }}}

 I haven't done this yet in the updated patch.

 > As a developer, I would expect that I *would* get this stuff, except in
 the case of fields=ids.

 Gotcha.  `02.patch` should address this.

 The return format for `fields=component` now reverts to the familiar:

 {{{
 Array(
     ['activities'] => array
        [0] => stdClass Object
            (
                 [id] => 4
                 [component] => activity
                 [type] => activity_update
            )
     ['has_more_items'] => BOOL
 )
 }}}

 Had to add a bunch of `isset` checks everywhere to avoid notices
 (particularly the activity action callbacks) since a dev might not be
 fetching all fields.

--
Ticket URL: <https://buddypress.trac.wordpress.org/ticket/6426#comment:6>
BuddyPress Trac <http://buddypress.org/>
BuddyPress Trac


More information about the buddypress-trac mailing list