[buddypress-trac] [BuddyPress Trac] #6794: Add Filter for bp_activity_get_activity_id args

buddypress-trac noreply at wordpress.org
Wed Dec 23 21:07:22 UTC 2015


#6794: Add Filter for bp_activity_get_activity_id args
----------------------------------+-----------------------------
 Reporter:  danbrellis            |      Owner:
     Type:  idea                  |     Status:  new
 Priority:  normal                |  Milestone:  Awaiting Review
Component:  Component - Activity  |    Version:  2.4.0
 Severity:  normal                |   Keywords:
----------------------------------+-----------------------------
 So the bp_activity_get_activity_id() in bp-activity/bp-activity-
 functions.php takes an $args array and then gets an activity id using
 BP_Activity_Activity::get_id().

 The returned id is filtered using bp_activity_get_activity_id, but this
 only filters the id and doesn't include the $args array or any other
 information for a function to use that is hooking to it.

 I don't see the point in filtering the returned activity id if you don't
 have any context. I think that (at the least) the return should include
 the $args, like so:

 {{{#!php
 return apply_filters( 'bp_activity_get_activity_id',
 BP_Activity_Activity::get_id(
   $r['user_id'],
   $r['component'],
   $r['type'],
   $r['item_id'],
   $r['secondary_item_id'],
   $r['action'],
   $r['content'],
   $r['date_recorded']
 ), $args );
 }}}

 Ideally though, we should be able to hook into a filter to change the
 $args before it's sent to get_id(). Something like this would make sense
 when $args is being parsed to $r:

 {{{#!php
 $r = bp_parse_args( apply_filters('bp_activity_get_activity_id_args',
 $args), array(
   'user_id'           => false,
   'component'         => false,
   'type'              => false,
   'item_id'           => false,
   'secondary_item_id' => false,
   'action'            => false,
   'content'           => false,
   'date_recorded'     => false,
 ) );
 }}}

--
Ticket URL: <https://buddypress.trac.wordpress.org/ticket/6794>
BuddyPress Trac <http://buddypress.org/>
BuddyPress Trac


More information about the buddypress-trac mailing list