Skip to:
Content

BuddyPress.org

Ticket #7882: 7882.diff

File 7882.diff, 1.9 KB (added by boonebgorges, 18 months ago)
  • src/bp-members/bp-members-functions.php

    diff --git src/bp-members/bp-members-functions.php src/bp-members/bp-members-functions.php
    index 85d02d62a..ba0fc14ff 100644
    function bp_update_user_last_activity( $user_id = 0, $time = '' ) { 
    999999                $time = bp_core_current_time();
    10001000        }
    10011001
    1002         // As of BuddyPress 2.0, last_activity is no longer stored in usermeta.
    1003         // However, we mirror it there for backward compatibility. Do not use!
    1004         // Remove our warning and re-add.
    1005         remove_filter( 'update_user_metadata', '_bp_update_user_meta_last_activity_warning', 10 );
    1006         remove_filter( 'get_user_metadata', '_bp_get_user_meta_last_activity_warning', 10 );
    1007         bp_update_user_meta( $user_id, 'last_activity', $time );
    1008         add_filter( 'update_user_metadata', '_bp_update_user_meta_last_activity_warning', 10, 4 );
    1009         add_filter( 'get_user_metadata', '_bp_get_user_meta_last_activity_warning', 10, 4 );
     1002        /**
     1003         * Filters whether the legacy mirroring of last_activity to usermeta should be disabled.
     1004         *
     1005         * User last_activity data was moved to the activity tables in BuddyPress 2.0, but
     1006         * continued to be mirrored to usermeta for backward compatiblity. In BuddyPress 4.0,
     1007         * this mirroring was disabled by default.
     1008         *
     1009         * @since 4.0.0
     1010         *
     1011         * @param bool $enable True to enable legacy usermeta mirroring. Default false.
     1012         */
     1013        if ( apply_filters( 'bp_mirror_user_last_activity_to_usermeta', false ) ) {
     1014                // Remove our warning and re-add.
     1015                remove_filter( 'update_user_metadata', '_bp_update_user_meta_last_activity_warning', 10 );
     1016                remove_filter( 'get_user_metadata', '_bp_get_user_meta_last_activity_warning', 10 );
     1017                bp_update_user_meta( $user_id, 'last_activity', $time );
     1018                add_filter( 'update_user_metadata', '_bp_update_user_meta_last_activity_warning', 10, 4 );
     1019                add_filter( 'get_user_metadata', '_bp_get_user_meta_last_activity_warning', 10, 4 );
     1020        }
    10101021
    10111022        return BP_Core_User::update_last_activity( $user_id, $time );
    10121023}