#6971 closed defect (bug) (fixed)
Params for bp_get_activity_content_body filter should be the same whatever the context
Reported by: | imath | Owned by: | boonebgorges |
---|---|---|---|
Milestone: | 2.8 | Priority: | normal |
Severity: | normal | Version: | |
Component: | Activity | Keywords: | has-patch |
Cc: | lmoffereins@… |
Description
In bp-activity-template.php
it's :
apply_filters_ref_array( 'bp_get_activity_content_body', array( $activities_template->activity->content, &$activities_template->activity ) )
2 arguments: the content + the full activity object
In bp-legacy/buddypress-functions.php it's
apply_filters( 'bp_get_activity_content_body', $activity->content )
1 argument the content only
In bp-activity-notifications.php
it's
apply_filters( 'bp_get_activity_content_body', $params['content'] );
`
1 argument the content only
And in class-bp-activity-list-table.php
it's
apply_filters_ref_array( 'bp_get_activity_content_body', array( $item['content'] ) )
1 argument the content only.
As soon as you only need the content, it's ok. But if you need the full activity object to check for additional properties, it's a nightmare!
The filter should always include 2 params imho.
Attachments (1)
Change History (11)
#4
@
8 years ago
- Cc lmoffereins@… added
- Milestone changed from Future Release to 2.8
Definitely something I'd like to see fixed for 2.8! I'll have it on my list.
@
8 years ago
I have added an activity object as a second parameter at all the places where bp_get_activity_content_body
filter is applied.
#6
@
8 years ago
- Owner set to boonebgorges
- Status changed from new to assigned
@sanket.parmar Thanks for the patch! Because the "primary" instance of the filter passes the activity object by reference, we should do the same thing in every instance. In some cases, this means we'll have to switch to apply_filters_ref_array()
.
Passing both parameters sounds good to me, imath!