Opened 10 years ago
Closed 10 years ago
#6293 closed enhancement (fixed)
Support customising of activity content for custom post type activities
Reported by: | rogercoathup | Owned by: | imath |
---|---|---|---|
Milestone: | 2.3 | Priority: | normal |
Severity: | normal | Version: | |
Component: | Activity | Keywords: | has-patch |
Cc: |
Description
The new code for custom post type activities provides a mechanism for customising the activity action field, but doesn't provide a means to customise the activity content field.
Customising activity content requires access to the post for which the activity is being generated. I suggest this is best achieved by:
- passing a content callback function as a parameter when the custom post type activity tracking is registered (bp_activity_set_post_type_tracking_args), and / or
- providing a filter (hooked on the activity type) that allows the content to the overridden before saving
If option 1, I'm not sure if this is extendable to the register_post_type mechanism for custom post type activity tracking registration.
Attachments (1)
Change History (7)
#2
@
10 years ago
agreed @imath, that sounds a simple enhancement, and even greater applicability than just custom post type activities.
#3
@
10 years ago
- Component changed from API to Component - Activity
- Keywords has-patch added
- Milestone changed from Awaiting Review to 2.3
With 6293.patch you could filter bp_before_activity_add_parse_args
#4
@
10 years ago
- Would make a nice enhancement. In the meantime, you can use the existing
'bp_get_activity_content_body'
filter.
- A new filter before saving is not necessary. Use the
'bp_activity_before_save'
hook:
function my_activity_before_save( $activity ) { if ( 'whatever' === $activity->type ) { $activity->content = 'blah'; } } add_action( 'bp_activity_before_save', 'my_activity_before_save' );
Thanks for your feedback @rogercoathup
I think a good first step would be to actually include a filter in
bp_activity_add()
. We are usingbp_parse_args()
in this function without including a filter.