I’m trying to find an easy way to get the name for a user from a user_id. This is easy if the user is logged in ($bp->loggedin_user->fullname), but in this case I want to get the name of a different user to that I can display it for the logged in user. All I have is the user_id of the user.
I could use the WordPress functions to get the display_name:
$user_info = get_userdata($referring_user_id);
$referring_user = $user_info->display_name;
But the display_name is just the username and not the value in the name field.
Any ideas on how to get this? Or possibly a way to always keep the display_name in WordPress synched with the name in BP?