bp_get_user_last_activity

Filters the last activity for a given user.

Description

apply_filters( 'bp_get_user_last_activity', (string) $activity, (int) $user_id ); 

Parameters (2)

0. $activity (string)
Time of last activity, in Y-m-d H:i:s format or an empty string if none found.
1. $user_id (int)
ID of the user being checked.

Usage

To run the hook, copy the example below.
  1. $activity = apply_filters( 'bp_get_user_last_activity', $activity, $user_id ); 
  2.  
  3. if ( !empty( $activity ) ) { 
  4.  
  5. // everything has led up to this point... 
  6.  
  7.  
The following example is for adding a hook callback.
  1. // define the bp_get_user_last_activity callback 
  2. function filter_bp_get_user_last_activity( $activity, $user_id ) { 
  3. // make filter magic happen here... 
  4. return $activity
  5. }; 
  6.  
  7. // add the filter 
  8. add_filter( 'bp_get_user_last_activity', 'filter_bp_get_user_last_activity', 10, 2 ); 
To remove a hook callback, use the example below.
  1. // remove the filter 
  2. remove_filter( 'bp_get_user_last_activity', 'filter_bp_get_user_last_activity', 10, 2 ); 

Defined (1)

The filter is defined in the following location(s).

/bp-members/bp-members-functions.php  
  1. return apply_filters( 'bp_get_user_last_activity', $activity, $user_id );