vForums Support > Programming & Coding :: Code Requests & Support :: > Referral code request

Referral code request - Posted By Aiken (ionfortuna) on 8th Dec 09 at 4:41am
I would like to have a referral code using a link based referral if possible and using a additional profile field with the username of the referrer.

I have 2 profile fields for referrals:
#8 = Referrer
#9 = Referred (number)

I would also like a user link on the mini profile linking to the referrer

My forum: http://xenqarnarp.vforums.co.uk/

Re: Referral code repuest - Posted By Ross (admin) on 9th Dec 09 at 4:32pm
Hi,

We've got something being worked on which should make something along these lines possible. Hopefully I'll be able to get it released to all forums towards the end of next week {Smile}

Re: Referral code repuest - Posted By Aiken (ionfortuna) on 13th Dec 09 at 6:05pm
What is it that you are working on and how will it help with my request?

Re: Referral code repuest - Posted By Ross (admin) on 16th Dec 09 at 3:56pm
Hi,

This was the feature I was referring to:

http://blog.hostedmessageboards.com/2009/12/custom-registration-process/

It enables you to add extra fields to the registration form, such as a referrer field. From there, it should be pretty simple for someone to setup a system which enables this field to be automatically populated using a referral link. When I get chance, I will see about doing this {Smile}

- Ross

Re: Referral code repuest - Posted By Aiken (ionfortuna) on 16th Dec 09 at 4:03pm
Oh, thanks

Re: Referral code repuest - Posted By Aiken (ionfortuna) on 20th Dec 09 at 2:20am
Now that the feature is up and running how about a code for this now?

Re: Referral code repuest - Posted By Aiken (ionfortuna) on 11th Jan 10 at 5:37pm
Um, anyone?

Re: Referral code repuest - Posted By Michael (wrighty) on 11th Jan 10 at 7:36pm
It's not possible to count the total referrals, but the auto filling in of that field is possible! {Smile}

Re: Referral code repuest - Posted By Aiken (ionfortuna) on 11th Jan 10 at 8:01pm
I want that much at least, I can count the number manually

Re: Referral code repuest - Posted By Aiken (ionfortuna) on 12th Jan 10 at 12:09am
Got a code for autofilling that field?

And with a username in that field how would I display it in the mini-profile so that it links to that user's page with the correct group, like:

Referred By: Ross
or
Referred By: Michael

Re: Referral code request - Posted By Michael (wrighty) on 12th Jan 10 at 5:59am
I'll write the code later today to get it done for you. {Smile}
I'm just in the process of working out how best to do it, 'cause currently it won't show like that, but it might be able to change it or something. {Smile}

Re: Referral code request - Posted By Aiken (ionfortuna) on 12th Jan 10 at 1:26pm
Alright

Re: Referral code request - Posted By Aiken (ionfortuna) on 24th Feb 10 at 5:00pm
The only thing I really need at this point is to fill in the field on the registration page using the url like: /action/register/referrer/admin

Most likely using the string.match(RegExp) method in some way

Re: Referral code request - Posted By Michael (wrighty) on 27th Feb 10 at 7:58am
Can you create an extra profile field with the text:

"Referrer:"

(without the quotes), and a link to the registration page on your forum where you're using this. Make sure that this extra profile field is visible on the register page. {Smile}

Re: Referral code request - Posted By Aiken (ionfortuna) on 27th Feb 10 at 9:59am
Registration page: http://tfah.vforums.us/action/register

Re: Referral code request - Posted By Michael (wrighty) on 27th Feb 10 at 10:24am
Try this in the main footer:

<script type = 'text/javascript'>
/* Referrer Code - Custom Field Version - Michael */
var f = 'custom4';
if(location.href.match(/\/r\/(.+?)($|\/)/))
     document.getElementsByName(f)[0].value = RegExp.$1;
</script>


I haven't tested it but it should work.

Then you can use the link http://tfah.vforums.us/action/register/r/admin
I'm using /r/username because many people might misspell referrer etc... {Smile} And r keeps it nice and short. {Smile}

Let me know if there's any problems. {Smile}

Re: Referral code request - Posted By Aiken (ionfortuna) on 27th Feb 10 at 10:45am
It works, can explain a little with the RegExp you used to get the value, idk how to get a value out of RegExp

Re: Referral code request - Posted By Aiken (ionfortuna) on 26th Apr 10 at 10:02pm
I would like another code related to this, I would like one that shows user's referral link on their profile but only to that person

Re: Referral code request - Posted By Michael (wrighty) on 26th Apr 10 at 10:09pm
Where would you like it showing...?

And to clarify, if you went to your profile, you would see your referral link?




Re: Referral code request - Posted By Aiken (ionfortuna) on 26th Apr 10 at 10:16pm
Correct

Either above or below the sig or as a psuedo-link around where modify profile is at, the main thing is that people must be able notice it an understand what it is

Re: Referral code request - Posted By Michael (wrighty) on 26th Apr 10 at 10:30pm
Main Footer:

<script type = 'text/javascript'>
/* Referral Link in Profile - Wrighty */
if((location.href.match(/\/profile\/(.+?)(\/|$)/) && RegExp.$1 == vf_username) || location.href.match(/\/view_profile(\/|$)/)){
     with(a = document.createElement('a')){
          href = '#'
          innerHTML = "My Referral Link";
          onclick = function(){
               prompt("The below link is your referral link, use it to gain referrers.", "http://" + location.host + "/action/register/r/" + vf_username);
          }
     }
     with(get('span', 'tag', get('profile_links', 'id'))[0]){
          appendChild(document.createTextNode(" :: "));
          appendChild(a);
     }
}
</script>


{Smile}

Re: Referral code request - Posted By Aiken (ionfortuna) on 26th Apr 10 at 10:34pm
Works

Re: Referral code request - Posted By Michael (wrighty) on 26th Apr 10 at 10:34pm
{Smile}
Glad it does.