News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

Referrals Mod

Started by karlbenson, July 23, 2007, 07:04:38 PM

Previous topic - Next topic

karlbenson



REFERRALS MOD v1.4
By Karl Benson



Introduction
A simple referral modification (with upto 60 day referral tracking cookie).

Installation
Simply install the package to install this modification on the Default theme.

If your using a non-custom theme I recommend the Modification Parser by Daniel 15 to get the Manual Theme Edits required.

Features
o Adds a referral link to each users profile area

http://www.youposted.com/index.php?referredby=1
(where 1 is the user id)

o Users can then paste the link to whoever they want to invite - suitable for email, signatures, messengers, webpages, forums etc
o When a guest/visitor uses the referral link a 'tracking' cookie is placed on their computer, so they can browse away from the link and register on your forum upto 60 days later (unless cookies are deleted) with the referral credited to the referring user.

o Adds 2 Referral stats section showing;
:: Top 5 Referrers (By Referrals)
:: Top 5 Referrers (By Referred Members Posts)
:: Daily/Monthly/Yearly Referrals Stats
o Total Referrals of each user shown in the poster information of each post
o Referrals information shown in Profile Summary
::  Shows referral link in profile
::  Showing No. of Referrals
::  Dropdown showing each member user has referred (Linked to the members profile pages)
::  Referral Hits (a.k.a No. of Clicks on your referral link)
o Referred member information also shown in Profile Summary
::  If user was referred, shows the user who referred them and the original date of referral

Support
Please use the modification thread for support with this modification.  (Please don't ask me to do the manual edits for you)

Languages
o English / English UTF-8
If you have any translations for any other languages, I would be grateful if you would send them to me via PM or in the Mods topic.

Before you request a crazy feature addition...
... please remember that this is a SIMPLE referral mod. I intend to keep it as simple as possible with only minor tweaks, bug fixes and updates for future SMF version support.

Changelog
1.0 BETA - 29th May 2007
o Initial release made per SMF user request.
1.1 - 14th June 2007
o Few tweaks - moving it out of BETA
o Wrote out the manual edits
o Improved the readme/documentation for this mod
1.2 - 31st July 2007
o Fixed a stats bug (Reported by Nitins60/Fixed by Lanthan)
1.3 - 6th August 2007
o Fixed XML stats bug (Bugfix provided by Lanthan (thanks again!)
o Fixed stats bug (unfortunately caused some stats bugs)
o Fixed install mysql bug (Reported/BugFix by Lanthan)
o Fixed error referredby (caused when user registered without using referral link)
o Members referral link now shown in an input box to copy
1.4 - 2nd September 2007
o Added - Profile - Selecting a person you referred in the drop down menu will take you to their profile
o Fixed huge stats bar bug
o Added English UTF-8 Support

nitins60

First one to download approved version

karlbenson

I must say a big thanks to groundup.

The referral mod had been in the queue for a long while (since end may).  With an hour or so of bringing it to his attention.  He tested the mod and gave me a couple of quick fixes to the installer.  I resubmitted it the Customisation Team who approved it. (apologies to any CT member who was also involved in approving it.)

Anyway, its out now! ;)

Flying Drupalist

Could this integrate with the invite mod? It would be really useful then! :D

karlbenson

At this time I don't plan on adding such functionality.

As far as I am aware there is no reason why both modifications could not be used on a forum.
Although I've never used the invite mod personally.

ormuz

The invite mod do the same thing this mod does!? I'm wrong?

karlbenson

As far as I'm aware the invite modification only allows you to invite individual people by sending out an email.
They need to use the specific url (with activation key) in the email.

However with the referral mod, you get a link which is suitable for your signature/email/posts/chatrooms/forums/messengers/blogs to invite anyone who uses the link.
Also users can browse away from the link, if they return within 60 days, using the same browser (and having not cleared cookies or cookies disabled), it will count the referral towards the users count.

ormuz

Quote from: karlbenson on July 24, 2007, 07:45:21 PM
However with the referral mod, you get a link which is suitable for your signature/email/posts/chatrooms/forums/messengers/blogs to invite anyone who uses the link.
Also users can browse away from the link, if they return within 60 days, using the same browser (and having not cleared cookies or cookies disabled), it will count the referral towards the users count.

The invite mod have this feature too, u can choose to invite people by mail or by refferal system! Take a lot to the mod and tell me if i'm wrong!

karlbenson

I've had a quick look at the modification.

These systems are quite different.  With the invite mod (as far as I can see) you invite people on a 1-2-1 basis.
Whereas the referral mod you invite people you don't necessarily know.

ormuz

I just need the refferal system in my site, but I'm using the invite mod because it don't give me problems in my joomla+smf site!

I've tested your mod and the cookies aren't "saved" in joomla+smf! I'm can't explain the problem in english by the correct way, because my english is poor! But let me try...

For example, I've SEF urls (Matt hack on joomla bridge board),

www.xpto.com/community/refferedby/id dont' work
www.xpto.com/community/register/refferedby/id only work by this link

If u join the site by the normal referral URL (1st example)  the cookies don't save the information...

PS: This is just in the joomla+smf bridge!

karlbenson

hmmm.

I haven't tried on a bridged version. But I'll look into it.

I've had a quick look at the code, and the cookie stored has no bearing on the action=register.
In the load.php source file (should be universal, not action specific) it detects if $_REQUEST['referredby'] exists, and if so STORES the cookie.

Only on the register action does it check whether a cookie has been stored and LOADS it.

I don't know how the bridge works, however if the url is converted, the format would be
www.xpto.com/community/referredby/1

In the beta which I posted, some people were getting it to work with a joomla bridge
http://www.simplemachines.org/community/index.php?topic=174132.20

Flying Drupalist

hi, I love the idea behind this mod, but also the invite mod. The invite mod allows you to send emails to friends for invitation... you can do this here too but it's not as easy. Also invites sent with the invite mod doesn't get added to referrals and vice versa. I just feel as if both mods are essentially two sides of the same coin. They accomplish the same purpose and really need to be combined to be comprehensive...

karlbenson

I don't think that many people would use both the invite and referral mod.

They suit different types of boards, with not much crossover.

Danniboi

Great mod mate! my users love it already and now iv got a competition going thanks to this mod :D

nitins60

I am getting this error in log
Quote
http://akaakaaka.com/forum/index.php?action=register2

Undefined index: referred by
File: /home/xxx/forum/Sources/Register.php
Line: 335

AdrenalineRider

Wonderfull Mod, had waited for a long time for this one. Now its here and works perfectly.

karlbenson : Wonderfull Job ;)

Please help me out with a small issue. The display of Referral is not reflected on TPSimplicity, could you please help me out here ... ;)

karlbenson

You will need to manually install (all or parts) on each theme depending on which custom files each has

See http://docs.simplemachines.org/index.php?topic=402

nitins60: That error shouldn't be a problem for now.  But I'll try to fix it for the next version.

alo

:D work fine for me, thanks!

Lanthan

Thanks for this fantastic Mod. This was something I have waited for..

But I have found a little Error in it, regarding the stats. He counts for every Registered Member the Referral in the Monthly/daily Stats.

But if you change this:

// NOW THAT USER HAS BEEN REGISTERED
// NEED TO INCREASE REFERRALSNO TALLY FOR USER
updateMemberData((int) $_POST['referredby'], array('referralsno' => 'referralsno + 1',));
trackStats(array('referrals' => '+'));

// UNCOMMENT THE FOLLOWING IF YOU WANT USERS TO BENEFIT BY +25 PER REFERRAL
// updateMemberData((int) $_POST['referredby'], array('karmaGood' => 'karmaGood + 25',));

// don't forget it we had a cookie stored to delete it
if(isset($_COOKIE['smfreferrals']))
{
// setting the cookie in the past and empty forces the browser to delete it
setcookie ("smfreferrals", "", time()-60000);
}


to

// don't forget it we had a cookie stored to delete it
if(isset($_COOKIE['smfreferrals']))
{
// NOW THAT USER HAS BEEN REGISTERED
// NEED TO INCREASE REFERRALSNO TALLY FOR USER
updateMemberData((int) $_POST['referredby'], array('referralsno' => 'referralsno + 1',));
trackStats(array('referrals' => '+'));

// UNCOMMENT THE FOLLOWING IF YOU WANT USERS TO BENEFIT BY +25 PER REFERRAL
// updateMemberData((int) $_POST['referredby'], array('karmaGood' => 'karmaGood + 25',));

// setting the cookie in the past and empty forces the browser to delete it
setcookie ("smfreferrals", "", time()-60000);
}


it should work better.

Best Regards
Lanthan

karlbenson

Thanks Lantham.

I believe this was the cause of the errors in the logs reported by nitins60.
(when someone registers who wasnt referred, it gave the error.)

I've incorporated the fix into the mod.  V1.2 now available from the mod section.

If you've installed it already you can just perform the 'EXACT' edit above.

enjoy!

Advertisement: