You can’t use an object variable, $user->display_name
, in a string.
And why would you want a tab that links back to the member being viewed? You’re already viewing that member.
This will provide the url of the displayed member: bp_displayed_user_domain()
So you could do this:
function redirect_user_to_tab3(){
bp_core_redirect( bp_displayed_user_domain() );
}
If you just want the user name for the currently displayed user so that you can build an url, you could do this:
function redirect_user_to_tab3(){
$url = site_url() . '/slug/' . bp_get_displayed_user_username();
bp_core_redirect( $url );
}