Skip to:
Content

Opened 10 months ago

Last modified 5 months ago

#7882 new enhancement

Stop mirroring user last_activity data to usermeta

Reported by: boonebgorges Owned by:
Milestone: Up Next Priority: normal
Severity: normal Version: 2.0
Component: Members Keywords: has-patch
Cc:

Description

Previously: #5128

The primary storage location for user 'last_activity' is the activity table. For backward compatiblity, we mirror that data in usermeta. See https://buddypress.trac.wordpress.org/browser/tags/3.0.0/src/bp-members/bp-members-functions.php?marks=1002-1009#L976

Now that we are moving toward something like semver, we have more of an opportunity to phase this out. I suggest that in 4.0, we stop doing this mirroring by default, but allow plugins to reenable it via filter. We would then publish a notice on the bpdevel blog warning plugin authors about the change.

Attachments (1)

7882.diff (1.9 KB) - added by boonebgorges 9 months ago.

Download all attachments as: .zip

Change History (5)

#1 follow-up: @DJPaul
10 months ago

I think it’s time to stop the sync yes.

But how about add a filter to user meta that intercepts the request before it’s made, and we call activity meta and return that instead? Maybe that’s the filterable option rather than reenabling the sync.

#2 in reply to: ↑ 1 @boonebgorges
10 months ago

Replying to DJPaul:

I think it’s time to stop the sync yes.

But how about add a filter to user meta that intercepts the request before it’s made, and we call activity meta and return that instead? Maybe that’s the filterable option rather than reenabling the sync.

If I'm understanding your suggestion correctly, then we already do this: https://buddypress.trac.wordpress.org/browser/tags/3.0.0/src/bp-members/bp-members-functions.php?marks=1053,1043#L1014

But yes, if we have a "enable legacy mode" filter, we can have it apply to both writing and retrieving.

@boonebgorges
9 months ago

#3 @boonebgorges
9 months ago

  • Keywords has-patch added; 2nd-opinion good-first-bug needs-patch removed

7882.diff is a first pass. The mirroring is disabled by default, but can be reenabled.

I haven't changed anything about the way the get_user_meta( 'last_activity' ) behavior works. It still triggers _doing_it_wrong(), and it still returns the value from the activity table. I don't see a reason why the new filter would affect this. Even if you're not mirroring - perhaps *especially* if you're not mirroring - developers ought to see the notice, and I don't think it causes any problems to continue to provide the correct value out of the activity table.

#4 @boonebgorges
5 months ago

  • Milestone changed from 4.0 to Up Next
Note: See TracTickets for help on using tickets.