BP_Friends_Friendship::get_bulk_last_active( array $user_ids )
Get the last active date of many users at once.
Description
Parameters
- $user_ids
-
(Required) IDs of users whose last_active meta is being queried.
Return
(array) $retval Array of last_active values + user_ids.
Source
File: bp-friends/classes/class-bp-friends-friendship.php
690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 | public static function get_bulk_last_active( $user_ids ) { global $wpdb ; $last_activities = BP_Core_User::get_last_activity( $user_ids ); // Sort and structure as expected in legacy function. usort( $last_activities , function ( $a , $b ) { if ( $a [ 'date_recorded' ] == $b [ 'date_recorded' ] ) { return 0; } return ( strtotime ( $a [ 'date_recorded' ] ) < strtotime ( $b [ 'date_recorded' ] ) ) ? 1 : -1; } ); $retval = array (); foreach ( $last_activities as $last_activity ) { $u = new stdClass; $u ->last_activity = $last_activity [ 'date_recorded' ]; $u ->user_id = $last_activity [ 'user_id' ]; $retval [] = $u ; } return $retval ; } |
Changelog
Version | Description |
---|---|
BuddyPress 1.0.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.