Opened 9 years ago
Closed 9 years ago
#6794 closed idea (fixed)
Add Filter for bp_activity_get_activity_id args
Reported by: | danbrellis | Owned by: | boonebgorges |
---|---|---|---|
Milestone: | 2.5 | Priority: | normal |
Severity: | normal | Version: | 2.4.0 |
Component: | Activity | Keywords: | |
Cc: |
Description
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:
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:
$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,
) );
I'm also wondering why it's necessary to filter the returned value of
BP_Activity_Activity::get_id()
. Maybe there's a reason?