View Full Version : Tell A Friend + Automatic Referral Code
Steve_S
01-10-2002, 10:00 PM
Tell A Friend + Automatic Referral Code
Edited 1-13-01. JavaScript pop version available at:
https://vborg.vbsupport.ru/showthread.php?postid=212838#post212838
The JS version permits you to place the link anywhere you want on your board.
This version in this post returns your members to the thread they were reading using the same browser window.
Purpose: Permit members to promote your Board via email using their unique Referral code which is automatically inserted. Reward them for x number of referrals :)
Does not require any modifications to source code but does require hacking.
Requires 3 custom templates and a renamed and hacked version of sendtofriend.php which I have called referbbtofriend.php
1. Create 3 custom templates which are really a save of your current templates with a new name:
sendtofriend saved as referbbtofriend
email_sendtofriend saved as email_referbbtofriend
redirect_sentemail saved as redirect_referbbsentemail
2. Edit your custom templates. See zip for mine
3. Grab your copy of sendtofriend.php and save it as referbbtofriend.php
Edit referbbtofriend.php as follows and place in your forum root:
Change this line
< $templatesused = "sendtofriend,email_sendtofriend,redirect_sentemail";
--- To this line
> $templatesused = "referbbtofriend,email_referbbtofriend,redirect_ref erbbsentemail";
Change this line
< eval("dooutput(\"".gettemplate("sendtofriend")."\");");
--- To This line
> eval("dooutput(\"".gettemplate("referbbtofriend")."\");");
Change this line
< eval("\$message = \"".gettemplate("email_sendtofriend",1,0)."\";");
--- To This line
> eval("\$message = \"".gettemplate("email_referbbtofriend",1,0)."\";");
Change this line
< eval("standardredirect(\"".gettemplate("redirect_sentemail")."\",\"showthread.php?s=$session[sessionhash]&threadid=".intval($threadid)."\");");
--- To This line
> eval("standardredirect(\"".gettemplate("redirect_referbbsentemail")."\",\"showthread.php?s=$session[sessionhash]&threadid=".intval($threadid)."\");");
4. Insert this link in your Show Thread Templates >> showthread template
<a href="referbbtofriend.php?s=$session[sessionhash]&threadid=$threadid">Tell a friend about your Board</a>
Notes: Uses a redirect to return them to the thread they were reading.
Thoughts and comments welcome.
Steve_S
01-11-2002, 08:36 PM
The screen capture of the prefilled form:
hypedave
01-11-2002, 09:22 PM
Cool, I get to be the first to install this, I am installing it now
hypedave
01-11-2002, 09:37 PM
when clicking on the reter to link, I get a blank screen ??
Steve_S
01-11-2002, 10:14 PM
Did you create the 3 custom templates and upload the hacked referbbtofriend.php ?
Please remeber that in the template named referbbtofriend (see the zip) you must call referbbtofriend.php
This:
<!----NOTE NEW NAME BELOW----->
<form action="referbbtofriend.php" method="post">
HTH
Myke O
01-11-2002, 10:49 PM
im doing it now ..... i dont have those 2 templates email and the refer one.... i only have sendtoafriend.php.... thats it
Myke O
01-11-2002, 11:05 PM
ahh i figured it out now... i love this HACK!!!!! thanks!!!!
Steve_S
01-11-2002, 11:17 PM
You welcome :)
Since this is my first effort I could have been just a tad more lucid in my instructions :) Another explanation:
You need to create 3 custom templates as per my instructions :) Here is another way:
1. Download the zip in the first post of this thread and open all 3 files in your editor. I have already edited these templates so if you don't like my stuff just change it.
2. Copy the text to the clipboard
3. Admin >> Templates >> Add
4. Paste the text into the template and name the templates exactly like the file names (no .txt)
5. Click the Save Button
eva2000
01-12-2002, 02:31 AM
nice one funkyduck :D
SirSteve
01-12-2002, 03:03 AM
Excellent! Thanks!
Steve_S
01-12-2002, 05:05 AM
Thanks. A JavaScript Popup version coming tomorrow which might be a little "cleaner" for some folks and faster for the folks on a dial up.
SirSteve
01-12-2002, 05:09 AM
great.... after I just installed this one! ;)
DelusionalMind
01-12-2002, 06:30 AM
nice :)
on my que for tomorrow :)
Lesane
01-12-2002, 10:18 AM
Nice hack, thanks.
Steve_S
01-12-2002, 06:27 PM
NEW: Tell A Friend + Automatic Referral Code via JavaScript Pop Up Instructions edited on 1-13-02 for new features.
NOTE: if you previously installed the "redirect" version but wan't to use the JS pop up version, please start over and download the zip in this post :)
Includes welcome and thank you by member name. Requires 4 custom templates.
1. Please download the .zip first which contains all the custom templates.
2. Grab your copy of sendtofriend.php and save it as referbbtofriend.php
Edit referbbtofriend.php as follows and place in your forum root:
Change this line
< $templatesused = "sendtofriend,email_sendtofriend,redirect_sentemail";
--- To this line
> $templatesused = "referbbtofriend_pop,email_referbbtofriend,referbbs entemail_thanks,";
Change this line
< eval("dooutput(\"".gettemplate("sendtofriend")."\");");
--- To this line
> eval("dooutput(\"".gettemplate("referbbtofriend_pop")."\");");
Change this line
< eval("standarderror(\"".gettemplate("error_requiredfields")."\");");
--- To this line
> eval("standarderror(\"".gettemplate("error_referbbtofriend")."\");");
Change this line
< eval("\$message = \"".gettemplate("email_sendtofriend",1,0)."\";");
--- To this line
> eval("\$message = \"".gettemplate("email_referbbtofriend",1,0)."\";");
Change this line
< eval("standardredirect(\"".gettemplate("redirect_sentemail")."\",\"showthread.php?s=$session[sessionhash]&threadid=".intval($threadid)."\");");
--- To this line
> eval("dooutput(\"".gettemplate("referbbsentemail_thanks")."\");");
REMOVE these 2 lines in referbbtofriend.php:
$threadid = verifyid("thread",$threadid);
$threadinfo=getthreadinfo($threadid);
2. Create the following 4 custom templates using the files which I have provided in the zip:
referbbtofriend_pop
error_referbbtofriend
email_referbbtofriend
referbbsentemail_thanks
Change my text in these templates to fit your site.
3. Insert the following JavaScript code anywhere on your Board you wish. Try header, footer, top of forums, user cp. Anywhere.
<!------NEW JS POP BELOW---->
<!-----begin pop up link---->
<script>
function openpopup(){
var popurl="referbbtofriend.php?s=$session[sessionhash]"
winpops=window.open(popurl,"","width=700,height=525,")
}
</script>
<a href="javascript:openpopup()">Tell a friend about your board</a>
<!------end pop up link---><!------END NEW----->
NOTE: In the last line (href) of the JS code above remove the space between java script so it reads javascript
Edited 1-13-02 for new features.
Enjoy :)
Steve_S
01-12-2002, 06:33 PM
The screen shot:
SirSteve
01-12-2002, 08:48 PM
Pop-up works great BUT can you make it where JUST the e-mail box shows up and not the vB header/footer. As it is now, you could have achieved the same affect by just using a TARGET="_BLANK" in the <A HREF> tag. It would load even faster without all that unneeded stuff.
Steve_S
01-12-2002, 09:04 PM
:)
Thanks.
If you used my template from the last zip I posted today for the form you have NO header or fotter for the form. See the file in the zip named referbbtofriend_pop.txt
You need to download the zip I posted for the JS version.
About the only thing I couldn't get just the way I want it is the error if fields are left blank.
HTH
SirSteve
01-12-2002, 09:18 PM
Oh, ok. I didn't see any different instructions for those that already had it installed so I just used the code above. Thanks. I am going to check it out now.
SirSteve
01-12-2002, 10:15 PM
Ok better, but once you submit the e-mail, it takes you back to the thread in that same window and that page will not fit in there...
Steve_S
01-12-2002, 11:19 PM
Nope. You need to start over and properly set up ALL the templates and properly edit referbbtofriend.php file.
NOTE: if you previously installed the "redirect" version but wan't to use the JS pop up version, please start over and download the last zip in this thread :)
At the conclusion of a submit you see the template named:
referbbsentemail_thanks. Check the screen capture I posted today. It works perfectly.
SirSteve
01-12-2002, 11:25 PM
I feel stupid... I guess I jumped the gun again. :)
Thanks!
Lucky
01-13-2002, 03:17 AM
Great idea!
Loving this one.
Thanks.
Stretchr
01-13-2002, 08:53 AM
Hope this isn't a stupid question but is there a way to place this link on the login page, without a user being in a thread? We're going to run a contest but, as a new board, it would be nice to be able to place a referral link there when a user logs in. Thanks :D
Lucky
01-13-2002, 02:56 PM
I like that idea.
Steve_S
01-13-2002, 03:31 PM
I like the idea but the .php file would need additional hacking so it does not require "&threadid=$threadid" With additional hacking you could place it anywhere as you suggest.
Anyone?
Stretchr
01-13-2002, 03:52 PM
That was the problem I ran into. The only way I could think to do it was to make a separate hack, otherwise, modifying the php file would then disable the original hack. Maybe this would be a good suggestion for the next version of VB. Certainly seems like a feature a lot of folks could use.
Stretchr
01-13-2002, 03:54 PM
BTW, thank you for this excellent hack. It really is useful. :)
Steve_S
01-13-2002, 04:43 PM
You welcome. Your idea is implemented :)
Issue resolved and tested with the JS version. Permits you to place the JS link anywhere you wan't
1. Remove the next 2 lines from referbbtofriend.php
$threadid = verifyid("thread",$threadid);
$threadinfo=getthreadinfo($threadid);
2. Edit the JS link to read:
var popurl="referbbtofriend.php?s=$session[sessionhash]"
Place the new JS code anywhere you want and loged in user can use it.
Stretchr
01-13-2002, 05:23 PM
Great! Thank you once again! :)
Steve_S
01-13-2002, 06:14 PM
This hack is really meant for members who must be loged in. I think this is your issue. Log in and test. Set forum permissions appropriately for Guests so they can't use this form.
HTH
Myke O
01-13-2002, 08:22 PM
your missing two semicolins in that script code
Lucky
01-14-2002, 01:36 AM
Originally posted by Steve_S
You welcome. Your idea is implemented :)
Issue resolved and tested with the JS version. Permits you to place the JS link anywhere you wan't
1. Remove the next 2 lines from referbbtofriend.php
$threadid = verifyid("thread",$threadid);
$threadinfo=getthreadinfo($threadid);
2. Edit the JS link to read:
var popurl="referbbtofriend.php?s=$session[sessionhash]"
Place the new JS code anywhere you want and loged in user can use it.
Thanks:)
nafae
01-15-2002, 04:33 PM
Ok thanks I got it working! (THX for clarification)
Stretchr
01-15-2002, 08:21 PM
You need to look closely at the instructions again. Those are TEMPLATES, not files and referbbtofriend.php is originally sendtofriend.php which you edit and rename and which comes with vB. It gets confusing sometimes, especially when you run into templates named similarly to files. Once I went through carefully and followed the instructions exactly it works great! HTH
Stretchr
01-16-2002, 01:44 AM
How do you retrieve the information on the referrals? Does it use the same table as the original referrals under Users in Admin CP?
Thanks to nafae for reminding me to ask an obvious question :D
nafae
01-16-2002, 01:57 AM
When I tried to refer someone, they registered, then when i check that referal thing in the admin cp it hasnt changed.. "no referrals for that time period"
hondastyle
01-17-2002, 02:02 AM
I just installed this hack on my boards.... verrrrry nice... Now I don't have to keep answering the same question over and over ('how do I get credit for referring somebody... how can I make a direct link to get referral credit..) lol...
Great job - js version is very nice. Thank you for this.
Chris
Steve_S
01-17-2002, 04:35 PM
The compliment to my "hacklette" is written by a real coder.
His royal hackness FiireFly. See:
https://vborg.vbsupport.ru/showthread.php?s=&threadid=25173
Iv'e not installed his hack but it looks like it lets' you put all the referral data on your board which will continue to encourage folks.
The referral code in my hack works perfectly. Log in and try it. Depending on your Forum Permissions for guests. See member hondastyle Board and thats the way it;s supposed to work.
Note: You can also put the referral link in your email templates and user cp if you wan't to remind your members.
Gutspiller
01-30-2002, 08:50 PM
I noticed when I tested this that when the person receiving the email it says something like "blahforum mailer" Is there a way to replace this with the variable that was placed in the "Send To:
(Person's Name)" field? This way they don't think it's a forum mailer and delete it? If this is possible it would be really cool.
Thanks.
BTW if anybody wants to see a demo they can check out my tweaked version of it here:
http://www.theforumz.com/forumz/index.php
You can see it a little lower than the top right. It doesn't work perfectly if you aren't registered, but you still get the idea. Mine is modified a good deal as well.
From what I've read you have to manually place the links to the JS script around the board.. Isn't there a simple way to make a template that will replace them all? Like a way to make all the old refer a friend links link to the JS popup? Maybe using a new template or replacing the old with this new code..? Clarification would be great. :cool:
Evoir
02-05-2002, 02:33 AM
Steve,
This is a really nice hack. Thanks.
I saw you mention in this thread that you weren't able to get the error code just the way you wanted it. What is happening for me is that if the fields are not filled out properly, the system uses the header and footer file, but within the javascript window. I believe I followed your directions completely. This only happens on the error page.
Is this supposed to be this way? Can it be fixed so the error message goes into the javascript window like the referbbsentemail_thanks template does?
Lucky
02-08-2002, 01:29 PM
Works in 2.2.2
Thank you kindly!
wvvwnet
03-04-2002, 02:40 AM
Thanks for this great code, but
I wonder if I can use the next URL
http://www.your-domain.com/register.php?referrerid=2s=&action=signup
will that account a point for the one whois # is (2)?
Or they will be able to register but will not account as a point?
What I mean, visitors will go directly to the sign up page instead of the mean page of the forum.
What do you think about that :eek:
Birdie501
03-14-2002, 08:46 AM
How can i change the configuration that if someone is not logged it that he first has to log in before he can see the pop up! Because i don't like it that the user is called "unregistered"??
Thanks! btw really nice hack!
Michael2
03-17-2002, 04:51 AM
Just wanted to thank you for your work on this! I love it! :)
Webmasta XT
03-18-2002, 10:14 AM
cool hack dude, nice work!!
freeshares1
05-03-2002, 08:50 PM
Just installed the javascript one and it works great.
Thanks
Phil
Bro_Joey_Gowdy
06-23-2002, 10:48 PM
Can something like this :
http://www.joeygowdy.com/forum/preview-invite-friend.html
be done for vb2.2.6 ??
If its already made - then where is it at
wvvwnet
07-07-2002, 05:08 PM
Dear sir,
I have
2.0.2
and when I click on the link, I got blank page says
Fatal error: Call to undefined function: updateuserforum() in /home/alameer/public_html/amt/referbbtofriend.php on line 22
please help :(
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.