i need help here.
I have a wordpress web system with referral functions.It is linked to a referral link.

But the problem is, i do not know how to extract the EXACT referral link and duplicate it and put it to sharing buttons. So that it will force the sharing to link the URL referral link instead of main site.

Example :

I have created a user g3.
g3 referral link is www.domain.com/ref=g3
but when i put plugin to share buttons, it only shares www.domain.com, not www.domain.com/ref=g3

In the first place, i do not know where does www.domain.com/ref=g3 is generated.

Here is the PHP code : it is not program by me. It is done by a mean developer who ran away after doing the project half way. Pls help.