Referrals ModSMF Version: 1.1.3
Description:
REFERRALS MOD v1.3
By Karl Benson
IntroductionA simple referral modification (with upto 60 day referral tracking cookie).
People using version < 1.3 are recommended to uninstall the current version and re-install 1.3 to get all the bug fixes for proper stats tracking.Warning!This mod is an initial release. Please report
any bugs you find, no matter how trivial.
Remember to backup your database AND files before installing any modifications, especially initial releases and betasInstallationSimply install the package to install this modification on the Default theme.
Manual edits will be required to install this modification onto custom themes which have custom templates of the following files;
- Profile.template.php
- Display.template.php
- Register.template.php
- Stats.template.php
- Xml.template.php
(Most custom themes will not have custom versions of all of those files, only where a custom version exists, will you need to perform the edits)
Profile.template.phpOpen Themes/{themename}/Profile.template.php, and FIND:
// Messenger type information.
ADD BEFORE:
// ADDS THE REFERRAL/REFERRED USER INFORMATION TO THE PROFILE SUMMARY
echo '<tr><td colspan="2"><hr size="1" width="100%" class="hrcolor" /></td></tr>
<tr>
<td><b>'.$txt['referrals_referrals'].'</b></td>
<td>'.$context['member']['referralsno'] .' ';
// SHOW IN DROPDOWN USERSNAME OF THOSE REFERRED
if(!empty($context['member']['referredmembers']))
{
echo '<select>';
foreach($context['member']['referredmembers'] as $x) {
echo $x;
}
// FREE KEVIN
unset($x);
echo '</select>';
}
echo' </td>
</tr>
<tr>
<td><b>'.$txt['referrals_referralshits'].'</b></td>
<td>'.$context['member']['referralshits'].'</td>
</tr>';
if (!empty($context['member']['referredby']) && $context['member']['referredby'] != 0)
{
echo' <tr>
<td><b>'.$txt['referrals_referredby'].'</b></td>
<td>'.$context['member']['referredbylink'].' '.$txt['referrals_on'].' '. date("jS M Y",$context['member']['referredon']).'
</td>
</tr>';
}
echo '<tr>
<td colspan="2"><b>'.$txt['referrals_link'].'</b></td></tr>
<tr><td colspan="2" style="text-align:center;"><input type="text" value="'.$scripturl.'?referredby='. $context['member']['id'] .'" style="width:330px;"/></td>
</tr>';
Display.template.phpOpen Themes/{themename}/Display.template.php, and FIND:
// Show how many posts they have made.
echo '
', $txt[26], ': ', $message['member']['posts'], '<br />
<br />';
REPLACE WITH:
// Show how many posts they have made.
echo '
', $txt[26], ': ', $message['member']['posts'], '<br />';
// show how many referrals they have made
echo $txt['referrals_referrals'].' '.$message['member']['referralsno'].'</br></br>';
Register.template.phpOpen Themes/{themename}/Register.template.php, and FIND:
// Are there age restrictions in place?
ADD BEFORE:
// IF REFERRAL INFORMATION IS SET IT WILL HAVE BEEN PASSED USING THIS VARIABLE
global $referrals;
if (isset($referrals))
{
echo ' <tr>
<td width="40%"><b>'.$txt['referrals_information'].'</b></td>
<td>'. $txt['referrals_youwerereferredby'].' '. $referrals['referredbyname'].
' '.$txt['referrals_on'].' '. date("jS M Y",$referrals['referredon']);
// NOW WRITE THE INFORMATION INTO HIDDEN INPUTS TO BE PASSED TO THE NEXT FUNCTION
echo ' <input type="hidden" name="referredby" value="'.$referrals['referredbyid'].'"/>
<input type="hidden" name="referredon" value="'.$referrals['referredon'].'"/>
</td>
</tr>';
}
If your theme has a custom Stats.template.php there are several additional manual modifications required to make the stats show on that theme (although it doesn't stop them being recorded)
If you are still having trouble, I recommend the
Modification Parser by Daniel 15
Featureso 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
:: 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
SupportPlease use the modification thread for support with this modification. (Please don't ask me to do the manual edits for you)
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.
Changelog1.0 BETA - 29th May 2007o Initial release made per SMF user request.
1.1 - 14th June 2007o 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 2007o Fixed a stats bug (Reported by Nitins60/Fixed by Lanthan)
1.3 - 6th August 2007o 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
ScreenshotsIn the poster information area of posts
On the profile area (showing people user has referred)
On the register area (showing registering user who referred them)
On the stats area (showing referrals stats)
On the profile area (showing who referred the user)
New in v1.3 (link shown in input box for easy copy and paste)
Link to Mod