Reply To: [Resolved] user page tab with a link to another site
Read codex page about bp-custom and my answer. You need an opening php tag at the first line of the file.
what you’re asking for is in the snippet. Read the comments (lines starting by //).
The restriction for logged-in users is already deactivated. So by default, the function run’s for ALL visitors.
To get dynamic links to friends, search the forum, you have many topics to find containing the right solution. Search for bpfr_, it will bring up a lot results containing snippets. And if not enough, check in Codex.