Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
08/02/2013 06:29:06 PM (11 years ago)
Author:
boonebgorges
Message:

Introduces bp_*_user_last_activity() functions

User last activity data is currently stored as usermeta, with BuddyPress
making multiple calls directly to the usermeta table to get that data. These
new functions provide a central, standardized way to update and fetch
last_activity information. This makes it easier for plugins to update user
activity programatically in a future-compatible way.

Having this set of functions will facilitate any changes associated with #5128,
whose goal is to move last_activity data out of usermeta altogether.

File:
1 edited

Legend:

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

    r7260 r7334  
    835835        return false;
    836836
    837     $activity = bp_get_user_meta( $user_id, 'last_activity', true );
     837    $activity = bp_get_user_last_activity( $user_id );
    838838
    839839    if ( !is_numeric( $activity ) )
     
    848848    }
    849849
    850     if ( empty( $activity ) || strtotime( $current_time ) >= strtotime( '+5 minutes', $activity ) )
    851         bp_update_user_meta( $user_id, 'last_activity', $current_time );
     850    if ( empty( $activity ) || strtotime( $current_time ) >= strtotime( '+5 minutes', $activity ) ) {
     851        bp_update_user_last_activity( $user_id, $current_time );
     852    }
    852853}
    853854add_action( 'wp_head', 'bp_core_record_activity' );
Note: See TracChangeset for help on using the changeset viewer.