bp_get_user_last_activity( int $user_id )
Get the last activity for a given user.
Description
Parameters
- $user_id
-
(Required) The ID of the user.
Return
(string) Time of last activity, in 'Y-m-d H:i:s' format, or an empty string if none is found.
Source
File: bp-members/bp-members-functions.php
function bp_get_user_last_activity( $user_id = 0 ) { $activity = ''; $last_activity = BP_Core_User::get_last_activity( $user_id ); if ( ! empty( $last_activity[ $user_id ] ) ) { $activity = $last_activity[ $user_id ]['date_recorded']; } /** * Filters the last activity for a given user. * * @since BuddyPress 1.9.0 * * @param string $activity Time of last activity, in 'Y-m-d H:i:s' format or * an empty string if none found. * @param int $user_id ID of the user being checked. */ return apply_filters( 'bp_get_user_last_activity', $activity, $user_id ); }
Changelog
Version | Description |
---|---|
BuddyPress 1.9.0 | Introduced. |
Questions?
We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.