BP_Friends_Friendship::sort_by_name( array $user_ids )
Sort a list of user IDs by their display names.
Description
Parameters
- $user_ids
-
(Required) Array of user IDs.
Return
(array) User IDs, sorted by the associated display names.
Source
File: bp-friends/classes/class-bp-friends-friendship.php
public static function sort_by_name( $user_ids ) { global $wpdb; if ( !bp_is_active( 'xprofile' ) ) return false; $bp = buddypress(); $user_ids = implode( ',', wp_parse_id_list( $user_ids ) ); return $wpdb->get_results( $wpdb->prepare( "SELECT user_id FROM {$bp->profile->table_name_data} pd, {$bp->profile->table_name_fields} pf WHERE pf.id = pd.field_id AND pf.name = %s AND pd.user_id IN ( {$user_ids} ) ORDER BY pd.value ASC", bp_xprofile_fullname_field_name() ) ); }
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.