News:

Wondering if this will always be free?  See why free is better.

Main Menu

Referral System

Started by SMFHacks.com Team, March 03, 2008, 01:02:01 PM

Previous topic - Next topic

Eliana Tamerin

Do NOT PM me for support.

SimplePortal 2.3.6 is OUT!
SimplePortal Project Manager
Download | Docs
SimplePortal: Power of Simplicity!

weightman

Yea, it works on your site for me. So, it looks like its not working on my site. My first guess is that it would be a conflict with the chess mod since I read about other problems that mod is having with other mods that use JS. If no one has any idea in this thread, I will post there.

Thanks very much

JoshieDaMan

Uninstall Actions
Uninstall Actions "Referrals Mod":
Installing this package will perform the following actions:
   Type    Action    Description
1.    Execute Modification    ./Sources/Load.php    Test successful
2.    Execute Modification    ./Sources/Register.php    Test successful
3.    Execute Modification    ./Sources/Stats.php    Test failed
4.    Execute Modification    ./Sources/Profile.php    Test successful
5.    Execute Modification    ./Themes/default/Register.template.php    Test successful
6.    Execute Modification    ./Themes/default/Display.template.php    Test successful
7.    Execute Modification    ./Themes/default/Stats.template.php    Test failed
8.    Execute Modification    ./Themes/default/Stats.template.php    Test failed
9.    Execute Modification    ./Themes/default/Profile.template.php    Test successful
10.    Execute Modification    ./Themes/default/languages/Modifications.english.php    Test failed

To uninstall the old version of referral mod so I could upgrade it. How get them to success?

JoshieDaMan

#43
Database Error
Duplicate column name 'referrals_no'
File: /home/public_html/Packages/temp/Referrals_Mod_v2.0.1/install.php
Line: 31

Fustrate

Joshie, first things first. You need to manually uninstall the parts that failed, just like if you were manually installing it (but backwards).

I'll look into the install.php error in an hour or so - gotta finish up some work that's got a deadline coming up tomorrow.
Steven Hoffman
Former Team Member, 2009-2012

JoshieDaMan

I looked into this, and I tried to delete it so I could start over and it says I have no permission to delete, and I as well cmod it to 777 so I could try to delete it, and it still won't let me delete that folder.

Fustrate

That's a PHP error that you can't get around, but it won't affect uninstalling.

Have you ever installed a package manually before? You'll just need to reverse the changes made to Stats.php, Modifications.english.php, and Stats.template.php yourself - after you've uninstalled the mod through the package manager.
Steven Hoffman
Former Team Member, 2009-2012

Sabre™

#47
I cannot see the manual edits via the package parser.
This is the result:
parseArchive(): No package-info.xml in this mod! Is it corrupted?

The mod installed via the package manager, but failed in the Display Template.
I installed anyway, then went to manually install the changes via package parser, with the above results.

Can somebody please post the manual installation for the display template?
And also any other edits needed to install this into custom themes.
I have already added the profile edit for custom themes, so that isnt needed :)

Thank You in advance :)

Also..  Are there permissions for this mod, to select who can see each persons referrals?
And to block others from seeing your referral code, to stop any form of abuse
eg..  Being posted on  "unsavory"  sites etc.
Do NOT give admin and/or ftp details to just anybody, see if they are trust worthy first!!  Do your homework ;)


Fustrate

Whenever you make changes this way, first make sure the package installer didn't do it first! Duplicate code creates errors!



Register.template.php
Search for:
// Are there age restrictions in place?
if (!empty($modSettings['coppaAge']))

Add this BEFORE it:

echo ' <tr>
<td width="40%"><b>', $txt['referrals_who'] ,'</b>
<div class="smalltext">', $txt['referrals_who_description'], '</div></td>
<td><input name="referredby" id="referredby" type="text" size="30" value="', ( !empty($context['referrals']['referred_by_name']) ? $context['referrals']['referred_by_name'] : '' ) ,'" />
<a href="', $scripturl, '?action=findmember;input=referredby;sesc=', $context['session_id'], '" onclick="document.getElementById(\'referredby\').value=\'\';document.getElementById(\'referredon\').innerHTML =\'&nbsp;\';return reqWin(this.href, 350, 400);"><img src="', $settings['images_url'], '/icons/assist.gif" border="0" alt="', $txt['referrals_findreferrer'] ,'" /> ', $txt['referrals_findreferrer'] ,'</a><br /><span id="referredon" class="smalltext">', ( !empty($context['referrals']['referred_date']) ? $txt['referrals_on'].' '.$context['referrals']['referred_date'] : '' ) ,'</span></td>
</tr>';










Display.template.php
Search for:
// Show how many posts they have made.
echo '
', $txt[26], ': ', $message['member']['posts'], '<br />

Add this AFTER it:
', $txt['referrals_referrals'].' '.$message['member']['referrals_no'].'<br />









Xml.template.php
Search for:
<day date="', $day['year'], '-', $day['month'], '-', $day['day'], '" new_topics="', $day['new_topics'], '" new_posts="', $day['new_posts'], '" new_members="', $day['new_members'], '" most_members_online="', $day['most_members_online'], '"', empty($modSettings['hitStats']) ? '' : ' hits="' . $day['hits'] . '"', ' />';
REPLACE it with:
<day date="', $day['year'], '-', $day['month'], '-', $day['day'], '" new_topics="', $day['new_topics'], '" new_posts="', $day['new_posts'], '" new_members="', $day['new_members'], '" most_members_online="', $day['most_members_online'], '" referrals="', $day['referrals'], '"', empty($modSettings['hitStats']) ? '' : ' hits="' . $day['hits'] . '"', ' />';










Stats.template.php
Search for:
foreach ($context['top_boards'] as $board)
echo '
<tr>
<td width="60%" valign="top">', $board['link'], '</td>
<td width="20%" align="left" valign="top">', $board['num_posts'] > 0 ? '<img src="' . $settings['images_url'] . '/bar.gif" width="' . $board['post_percent'] . '" height="15" alt="" />' : '&nbsp;', '</td>
<td width="20%" align="right" valign="top">', $board['num_posts'], '</td>
</tr>';

Add this AFTER it:

// Start of Referrals Mod Stats
echo '
</table>
</td>
</tr><tr>
<td class="catbg" colspan="2" width="50%"><b>'.$txt['referrals_top5referrers'].'</b></td>
<td class="catbg" colspan="2" width="50%"><b>'.$txt['referrals_top5referrersbyposts'].'</b></td>
</tr><tr>
<td class="windowbg" width="20" valign="middle" align="center"><img src="', $settings['images_url'], '/stats_info.gif" width="20" height="20" alt="" /></td>
<td class="windowbg2" width="50%" valign="top">
<table border="0" cellpadding="1" cellspacing="0" width="100%">';
if (empty($context['totalreferrals']))
echo '<tr>
<td valign="top" style="text-align:center">'. $txt['referrals_noneyet'] . '</td>
</tr>';
else
{
foreach ($context['top_referrers'] as $referrer)
echo '
<tr>
<td width="60%" valign="top">', $referrer['link'], '</td>
<td width="20%" align="left" valign="top">', $referrer['referrals_no'] > 0 ? '<img src="' . $settings['images_url'] . '/bar.gif" width="' . $referrer['referrals_percent'] . '" height="15" alt="" />' : '&nbsp;', '</td>
<td width="20%" align="right" valign="top">', $referrer['referrals_no'], '</td>
</tr>';
}

echo '
</table>
</td>
<td class="windowbg" width="20" valign="middle" align="center"><img src="', $settings['images_url'], '/stats_info.gif" width="20" height="20" alt="" /></td>
<td class="windowbg2" width="50%" valign="top">
<table border="0" cellpadding="1" cellspacing="0" width="100%">';
unset($referrer);
if (empty($context['totalreferralsposts']))
echo '<tr>
<td valign="top" style="text-align:center">'. $txt['referrals_noneyet'] . '</td>
</tr>';
else
{
foreach ($context['top_referrers_by_posts'] as $referrer)
echo '
<tr>
<td width="60%" valign="top">', $referrer['link'], '</td>
<td width="20%" align="left" valign="top">', $referrer['posts'] > 0 ? '<img src="' . $settings['images_url'] . '/bar.gif" width="' . $referrer['referralsposts_percent'] . '" height="15" alt="" />' : '&nbsp;', '</td>
<td width="20%" align="right" valign="top">', $referrer['posts'], '</td>
</tr>';
}
// End of Referrals Mod Stats



Search for:
<td width="15%">', $txt['smf_stats_7'], '</td>
<td width="15%">', $txt['smf_stats_8'], '</td>
<td width="15%">', $txt['smf_stats_9'], '</td>
<td width="15%">', $txt['smf_stats_14'], '</td>

REPLACE it with:
<td width="10%">', $txt['smf_stats_7'], '</td>
<td width="10%">', $txt['smf_stats_8'], '</td>
<td width="10%">', $txt['smf_stats_9'], '</td>
<td width="10%">', $txt['smf_stats_14'], '</td>
<td width="10%">',$txt['referrals_referralsstats'],'</td>



Search for:
<th align="center" width="15%">', $month['new_topics'], '</th>
<th align="center" width="15%">', $month['new_posts'], '</th>
<th align="center" width="15%">', $month['new_members'], '</th>
<th align="center" width="15%">', $month['most_members_online'], '</th>

REPLACE it with:
<th align="center" width="10%">', $month['new_topics'], '</th>
<th align="center" width="10%">', $month['new_posts'], '</th>
<th align="center" width="10%">', $month['new_members'], '</th>
<th align="center" width="10%">', $month['most_members_online'], '</th>
<th align="center" width="10%">', $month['referrals'], '</th>


Search for:
<td align="center">', $day['most_members_online'], '</td>
Add this AFTER it:
<td align="center">', $day['referrals'], '</td>]]></add>


Search for:
var dataCells = [
"date",
"new_topics",
"new_posts",
"new_members",
"most_members_online"

Add this AFTER it (don't forget the comma on the first line... so it's "most_members_online",):
,
"referrals",



Search for:
dataCells[5] = "hits";
dataCells[6] = "hits";





Profile.template.php
Search for:
// Messenger type information.
echo '
<tr>
<td colspan="2"><hr size="1" width="100%" class="hrcolor" /></td>
</tr><tr>
<td><b>', $txt[513], ':</b></td>
<td>', $context['member']['icq']['link_text'], '</td>

Add this BEFORE it:
// 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']['referrals_no'] .'  ';

// Show in dropdown usersname of those referred
if(!empty($context['member']['referredmembers']))
{

echo '<select onchange="location=options[selectedIndex].value;">
<option>'.$txt['referrals_membersreferred'].'</option>';
foreach($context['member']['referredmembers'] as $x)
echo $x;

// Tidy up
unset($x);
echo '</select>';
}
echo' </td>
</tr>
<tr>
<td><b>'.$txt['referrals_referrals_hits'].'</b></td>
<td>'.$context['member']['referrals_hits'].'</td>
</tr>';
if (!empty($context['member']['referred_by']))
{
echo' <tr>
<td><b>'.$txt['referrals_referred_by'].'</b></td>
<td>'.$context['member']['referred_bylink'].' '.$txt['referrals_on'].' '. date("jS M Y",$context['member']['referred_on']).'
</td>
</tr>';

}

echo '<tr>
<td colspan="2"><b>'.$txt['referrals_link'].'</b></td>
</tr>
<tr><td colspan="2" style="text-align:center;">
<script language="JavaScript" type="text/javascript"><!--//
function copy_referrallink()
{
// Create element (if does not exist)
if(!document.getElementById(\'clipboard\'))
{
var copydiv = document.createElement(\'div\');
copydiv.id = \'clipboard\';
document.body.appendChild(copydiv);
}

// Clear element
document.getElementById(\'clipboard\').innerHTML = \'\';
// Copy Referral Link
document.getElementById(\'clipboard\').innerHTML = \'<embed src="referrals_copytoclipboard.swf" FlashVars="clipboard=\'+encodeURIComponent(document.getElementById(\'referrallink\').value)+\'" width="0" height="0" type="application/x-shockwave-flash"></embed>\';
}
//--></script>
<input type="text" id="referrallink" value="'.$scripturl.'?referredby='. $context['member']['id'] .'" readonly="true" style="width:250px;" />
<a href="javascript:void(0);" rel="nofollow" onclick="javascript:copy_referrallink();return false;" title="'.$txt['referrallink_copy'].'">'.$txt['referrallink_copy'].'</a>
</td>
</tr>';

Steven Hoffman
Former Team Member, 2009-2012

Sabre™

#49
Mate...

You are a good man :)
I thank you very much, for the effort and time you put in to post these edits :)

+k


Is there a way to move the referrals link code, to another area?
eg.   The  "account related settings"  area in your profile.
So nobody else can access/see your personal code.

Thank You
Do NOT give admin and/or ftp details to just anybody, see if they are trust worthy first!!  Do your homework ;)


Fustrate

I don't quite see how that would help... remember, the 'code' is the same for everyone, just with your user id at the end. If my ID is 26, and my referral link is ?referredby=26, and I know your ID is 63, it's easy to assume that your link will just end in 63.

I'll look into it, though, just gotta do some other things first. Graduating is kind of a priority right now ;)
Steven Hoffman
Former Team Member, 2009-2012

Sabre™

LOL..
Yea true, I forgot the code was the same for everyone 

Good luck with your studies mate
When you graduate, then its all plain sailing from there, then you can spend your days like me
and your nights like the 1337 staff here!!! 

Just kiddin :D :D :D

All the best :)
Do NOT give admin and/or ftp details to just anybody, see if they are trust worthy first!!  Do your homework ;)


thenerd

Hi folks,

I am trying to install this mod on SMF 1.1.4 with a theme called Minerva. I get the following errors just before installation:

Installing this package will perform the following actions:
Type Action Description
1. Execute Modification ./index.php Test failed
2. Execute Modification ./Sources/Load.php Test successful
3. Execute Modification ./Sources/Register.php Test successful
4. Execute Modification ./Sources/Stats.php Test successful
5. Execute Modification ./Sources/Profile.php Test successful
6. Execute Modification ./Themes/default/Register.template.php Test successful
7. Execute Modification ./Themes/default/Display.template.php Test successful
8. Execute Modification ./Themes/default/Xml.template.php Test successful
9. Execute Modification ./Themes/default/Stats.template.php Test successful
10. Execute Modification ./Themes/default/Stats.template.php Test successful
11. Execute Modification ./Themes/default/Profile.template.php Test successful
12. Execute Modification ./Themes/default/languages/Modifications.english.php Test successful
13. Execute Modification ./Themes/default/languages/Modifications.english-utf8.php Skipping file
14. Execute Modification ./Themes/default/languages/Modifications.english_british.php Skipping file
15. Execute Modification ./Themes/default/languages/Modifications.english_british-utf8.php Skipping file
16. Extract File ./Sources/Referrals.php
17. Extract File ./referrals_copytoclipboard.swf
18. Execute Code install.php


Any ideas what I need to do to fix it?

Thanks
hxxp:www.techalpha.net/index.php?referredby=1 [nonactive]

Eliana Tamerin

Manually install the mod onto the index.php file.

Open up the file and find this line:
// Load the current user's permissions.
loadPermissions();


Then add this after it:
// Referrals Mod - Check For Referrals
global $context, $sourcedir;
if($context['user']['is_guest'] && (!empty($_GET['referredby']) || !empty($_COOKIE['smf_referrals'])))
{
require_once($sourcedir . '/Referrals.php');
checkReferral();
}


Then just continue on with the installation and ignore the error on the index.php file.
Do NOT PM me for support.

SimplePortal 2.3.6 is OUT!
SimplePortal Project Manager
Download | Docs
SimplePortal: Power of Simplicity!

thenerd

Thanks Eliana Tamerin that worked!

Cheers!
hxxp:www.techalpha.net/index.php?referredby=1 [nonactive]

Pip2andahalf

This thing works on the profiles, but for some reason the referrals arenot showing up on the posts. I am using Babylon theme. Any help please?

Also, is there a way to make the link on the profile visible only to the user when looking at their own profile?

Thanks!

Pip

Fustrate

Edit Themes/babylon/Display.php and make the edits I posted above for that file.

For the second thing, there's really no point in hiding it, because everyone automatically knows everyone else's (discussed in a post above).
Steven Hoffman
Former Team Member, 2009-2012

DR3NCH

The following code appears at the top of my forums:

Code (http://www.the-garbagecan.net/forums) Select

$txt['referrals_findreferrer'] = 'Find Referrer'; $txt['referrals_who'] = 'Referral Information:'; $txt['referrallink_copy'] = '[Copy]'; $txt['referrals_who_description'] = 'Did someone refer you to this site?'; $txt['referrals_on'] = 'On'; $txt['referrals_referrer_not_found'] = 'The referring user could not be found. Please double-check the name of the referrer. Or leave it blank.'; $txt['referrals_youwerereferred_by'] = 'By'; $txt['referrals_referrals'] = 'Referrals:'; $txt['referrals_referrals_hits'] = 'Referral Link Hits:'; $txt['referrals_noneyet'] = 'None Yet!'; $txt['referrals_top5referrers'] = 'Top 5 Referrers (By Referrals)'; $txt['referrals_top5referrersbyposts'] = 'Top 5 Referrers (By Referred Members Posts)'; $txt['referrals_referralsstats'] = 'Referrals'; $txt['referrals_referred_by'] = 'Referred By:'; $txt['referrals_link'] = 'Referrals Link:'; $txt['referrals_membersreferred'] = 'Members Referred';


I've uninstalled the package, erased the files from my server, and I've reinstalled all of the themes my forums use but this code still remains.

How do I remove this?
How do I remove it?

Eliana Tamerin

Open up your /Themes/languages/Modifications.english.php file.

Find that line (it's after ?>). Move it above the ?> and save it.

Should be fine then.
Do NOT PM me for support.

SimplePortal 2.3.6 is OUT!
SimplePortal Project Manager
Download | Docs
SimplePortal: Power of Simplicity!

DR3NCH

#59
Quote from: Eliana Tamerin on April 06, 2008, 01:50:54 PM
Open up your /Themes/languages/Modifications.english.php file.

Find that line (it's after ?>). Move it above the ?> and save it.

Should be fine then.

There is no directory or file called what you're discribing on my server.

EDIT:  Nevermind, I figured it out by myself like I should have.

Advertisement: