[buddypress-trac] [BuddyPress Trac] #5409: Changes to BP_Activity_Activity::get_last_updated() to get last id depending on contexts

buddypress-trac noreply at wordpress.org
Tue Feb 18 14:02:27 UTC 2014


#5409: Changes to BP_Activity_Activity::get_last_updated() to get last id
depending on contexts
-----------------------------------------+------------------
 Reporter:  imath                        |       Owner:
     Type:  defect (bug)                 |      Status:  new
 Priority:  normal                       |   Milestone:  2.0
Component:  Activity                     |     Version:
 Severity:  normal                       |  Resolution:
 Keywords:  has-patch reporter-feedback  |
-----------------------------------------+------------------
Changes (by boonebgorges):

 * keywords:  has-patch => has-patch reporter-feedback


Comment:

 imath - Thanks for putting this into a separate ticket.

 I'm not convinced that extending `get_last_updated()` in this way is
 appropriate. If I understand
 https://buddypress.trac.wordpress.org/attachment/ticket/5328/5328.02.diff
 correctly, you could just use bp_activity_get() for your purposes. In
 `bp_activity_heartbeat_last_recorded()`:

 {{{
 $activities = bp_activity_get( array(
     'search_terms'      => $data['bp_last_activity_update']['search'],
     'filter'            => $filter,
     'show_hidden'       => $show_hidden,
     'max'               => 1,
     'per_page'          => 1,
     'update_meta_cache' => false,
 ) );

 if ( ! empty( $activities['activities'] ) ) {
     $response['last_id_recorded'] = $activities['activities'][0]->id;
 }
 }}}

 It seems to me that we should move toward centralizing all of our
 component queries when possible, not reproducing query logic. This looks
 to me like a case where we can easily leverage the tools we already have.
 What do you think, imath?

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


More information about the buddypress-trac mailing list