Opened 6 years ago
Last modified 7 months ago
#8343 assigned defect (bug)
Custom Post Type activity in groups create duplicates
| Reported by: | etatus | Owned by: | imath |
|---|---|---|---|
| Priority: | normal | Milestone: | Awaiting Contributions |
| Component: | Activity | Version: | 2.2 |
| Severity: | normal | Keywords: | needs-patch |
| Cc: |
Description
If I add support for "buddypress-activity" to my CPT (with add_post_type_support() and bp_activity_set_post_type_tracking_args() functions) everything works fine.
If I especify 'component_id => 'groups' in bp_activity_set_post_type_tracking_args(), the tracking still works, but item_id is by default the blog ID instead the group ID, so the activity is created but it will not be shown in group activity page.
If I fix this, using bp_after_activity_add_parse_args filter to set item_id to the group ID ($args['item_id'] = bp_get_current_group_id();) the activity is created and it is shown in group activity page.
BUT...
The problem is everytime I update the post, a new activity is generated, so there will be several activities with exactly the same information for one single goup post.
Change History (12)
#3
@
5 years ago
- Keywords needs-patch added
- Milestone Awaiting Review → 10.0.0
- Severity major → normal
- Version 6.1.0 → 2.2
Hi @etatus
Thanks for your report. Reading your ticket, I realize the Post Type Activities API needs an improvement. Developers should be able to provide a new tracking argument: the callback function to use to get the single item_id for the selected component.
I'll try to have a look at it during 10.0.0. If someone wants to suggest a patch, they're very welcome 🙏.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
I found a workaround. It is not elegant, but it seems to avoid the creation of duplicate activities for the same cpt post on updating.