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

buddypress-trac noreply at wordpress.org
Mon Aug 17 21:13:15 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             |
----------------------------------+------------------
Changes (by r-a-y):

 * keywords:  needs-patch good-first-bug => has-patch


Comment:

 Attached is a first pass at a `'fields'` parameter in
 `BP_Activity_Activity::get()`.

 If you pass `'fields=ids'`, this will bypass pagination parameters and
 return only activity IDs.  I think it makes sense to bypass pagination in
 this case, but let me know if we shouldn't bypass pagination.

 If you pass `'fields=component,type'`, this will return the following
 format:


 {{{
 Array
 (
     [0] => stdClass Object
         (
             [id] => 4
             [component] => activity
             [type] => activity_update
         )

     [1] => stdClass Object
         (
             [id] => 5
             [component] => blogs
             [type] => new_blog_post
         )

     [2] => stdClass Object
         (
             [id] => 6
             [component] => activity
             [type] => activity_update
         )

 )
 }}}


 `id` is always added regardless.  My question is should the activity ID be
 the array key so it is similar to `WP_Query`'s `ids=parent`:


 {{{
 Array
 (
     [4] => stdClass Object
         (
             [component] => activity
             [type] => activity_update
         )

     [5] => stdClass Object
         (
             [component] => blogs
             [type] => new_blog_post
         )

     [6] => stdClass Object
         (
             [component] => activity
             [type] => activity_update
         )

 )
 }}}


 Also if you pass `fields=component,type`, you do not get any activity meta
 cache fetching, activity comment appending or `'has_more_items'` marker.

 Let me know if this is important to add back.

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


More information about the buddypress-trac mailing list