BP_Friends_Friendship::sort_by_name( array $user_ids )

Sort a list of user IDs by their display names.

Parameters Parameters


(array) (Required) Array of user IDs.

Top ↑

Return Return

(array) User IDs, sorted by the associated display names.

Source 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() ) );

Top ↑

Changelog Changelog

Version Description
1.0.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.