Opened 11 years ago
Closed 11 years ago
#6794 closed idea (fixed)
Add Filter for bp_activity_get_activity_id args
| Reported by: | danbrellis | Owned by: | boonebgorges |
|---|---|---|---|
| Priority: | normal | Milestone: | 2.5 |
| Component: | Activity | Version: | 2.4.0 |
| Severity: | normal | 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, ) );
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
I'm also wondering why it's necessary to filter the returned value of
BP_Activity_Activity::get_id(). Maybe there's a reason?