Function in a wordpress shortcode

I don’t think you want the display name – it may not be unique.

Try using the log-in name instead.

The user name for the displayed profile:

$myhope = bp_get_displayed_user_username();

The user name for the current user:

 $current_user = wp_get_current_user();
 $myhope = $current_user->user_login;