Opened 4 years ago
Last modified 4 years ago
#8348 new feature request
Enhance the bp_activity table design by adding site_id
Reported by: | shawfactor | Owned by: | |
---|---|---|---|
Milestone: | Awaiting Contributions | Priority: | normal |
Severity: | normal | Version: | 6.2.0 |
Component: | Activity | Keywords: | needs-patch |
Cc: |
Description
As it stands the bp_activity activity table has a major flaw that makes it very limitted when using multisite.
Right now if you need to create a custom activity the context of which site it applies to is not always clear.
For instance say I wanted to record activities relating post objects to a user on a specific site within a multisite. eg recording a mention within a post. The user_id would be the member who editted the post to add the mention. But then there are three remaining variables. That being the user mentioned, the site, and the post. But only two free fields in the database, that being item_id and secondary_item_id.
This could be fixed by adding a field to record the site_id in table. It could simply default to the main site when not specifically populated. But would greatly enhance the flexibility as all sorts of site specific actions could be recorded in the table
Change History (4)
#2
@
4 years ago
Yes, this is definitely an issue on multisite.
On a BP install, we're working around this by saving the site ID as activity meta:
add_action( 'bp_activity_after_save', function( $activity ) {
if ( ! bp_is_root_blog() ) {
bp_activity_update_meta( $activity->id, 'site_id', get_current_blog_id() );
}
} );
And then referencing the site ID whenever something needs to be done.
For example, whenever a site's visibility (blog_public
) is changed to something less than 1, we update all activity for the site to hide_sitewide = 1
. This is probably something BP should do in core. Also related is #4791, which talks about doing the same thing, but for group status changes.
#3
@
4 years ago
- Keywords needs-patch added
- Milestone changed from Awaiting Review to Awaiting Contributions
Hi @r-a-y & @shawfactor I'd say let's have it in BP Core! Who's volunteering to work on a patch?
I guess we'd also need to review some behaviors of the activity component and take in account all possible Multisite configurations: BP network Activated, BP activated on a subsite, BP Multiblog (and its possible specific needs like displaying only activities of the current blog, having the possibility to publish an activity network widely, etc..).
Can someone look at this, as I said the current table is limitted when used on multisite and could be MUCH better