bp_core_get_user_displaynames( array $user_ids )
Fetch the display name for a group of users.
Description
Uses the ‘Name’ field in xprofile if available. Falls back on WP display_name, and then user_nicename.
Parameters
- $user_ids
-
(Required) Array of user IDs to get display names for.
Return
(array) Associative array of the format "id" => "displayname".
Source
File: bp-members/bp-members-functions.php
function bp_core_get_user_displaynames( $user_ids ) { // Sanitize. $user_ids = wp_parse_id_list( $user_ids ); // Remove dupes and empties. $user_ids = array_unique( array_filter( $user_ids ) ); if ( empty( $user_ids ) ) { return array(); } // Warm the WP users cache with a targeted bulk update. cache_users( $user_ids ); $retval = array(); foreach ( $user_ids as $user_id ) { $retval[ $user_id ] = bp_core_get_user_displayname( $user_id ); } return $retval; }
Changelog
Version | Description |
---|---|
BuddyPress 2.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.