Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
02/12/2014 09:27:20 PM (10 years ago)
Author:
boonebgorges
Message:

Migrate user 'last_activity' data from usermeta to the activity table

Storing last_activity in usermeta caused severe bottlenecks on sites with
large user bases. The usermeta table has a tendency to get bloated. Its
option_value column is not indexed, and even if it were, it would not be
indexed properly for the kind of chronological sorting that BuddyPress was
using it for.

This changeset refactors all core last_activity user functionality, so that
the data is stored in the wp_bp_activity table (even when the activity
component is disabled).

For backward compatibility with plugins that reference last_activity metadata
entries, all last_activity data is retained in wp_usermeta, and new data will
be mirrored there until further notice.

See #5128

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-core/bp-core-functions.php

    r7809 r7860  
    10541054 * Plugin authors should use BP's _user_meta() functions, which bakes in
    10551055 * bp_get_user_meta_key():
    1056  *    $last_active = bp_get_user_meta( $user_id, 'last_activity', true );
     1056 *    $friend_count = bp_get_user_meta( $user_id, 'total_friend_count', true );
    10571057 * If you must use WP's _user_meta() functions directly for some reason, you
    10581058 * should use this function to determine the $key parameter, eg
    1059  *    $last_active = get_user_meta( $user_id, bp_get_user_meta_key( 'last_activity' ), true );
     1059 *    $friend_count = get_user_meta( $user_id, bp_get_user_meta_key( 'total_friend_count' ), true );
    10601060 * If using the WP functions, do not not hardcode your meta keys.
    10611061 *
Note: See TracChangeset for help on using the changeset viewer.