Hi BuddyPress Plugin/Theme developers,
Since BuddyPress 2.0.0, the primary storage location for the user last_activity
information is the activity
DB table. For backward compatibility reasons, we used to mirror that data into the usermeta
DB table.
This means you could get the last date the user was active on the community site in 2 ways:
- The right one using the
bp_get_user_last_activity( $user_id )
function. - The deprecated one using
bp_get_user_meta( $user_id, 'last_activity', false )
function.
Please note, starting in BuddyPress 7.0.0, we will stop mirroring the last_activity
user metadata, meaning the only way to get the last date the user was active is by using bp_get_user_last_activity( $user_id )
.
If your development absolutely needs this piece of information to also be available into the usermeta
DB table, then you’ll need to use the following filter to keep it there:
add_filter( 'bp_use_legacy_user_query', '__return_true' );
To read more about this change, see #7882.