Here is an example of what I’ve done:
<?php
$link = home_url( '/members/' . bp_core_get_username( bp_displayed_user_id() ) . '/followers/' );
echo "<a href="". esc_attr( $link ) ."">Followers</a>";
?>
So maybe its home_url
now, than site_url. In the echo, esc_attr
gives out the $link.
Change the whole bp_core_get_username( bp_displayed_user_id() )
to whatever you need – wp_get_current_user()
for example.