News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

Referral System

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

Previous topic - Next topic

weightman

The ultimate profile mod was a disaster for me- very buggy with no real support.

Fustrate

I have no idea what exactly you need from this, but this is the code that displays referrals:
        // 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

Sudhakar Arjunan

Hi Thanks for the Code.

Just check this page. http://forum.itacumens.com/index.php?action=profile;u=1

I got some error using the code. I have used this code.

Give me some edit to it.


// The Referral Mod - Author - YodaOfDarkness

echo '
<table border="0" cellpadding="4" cellspacing="1" class="bordercolor" width="100%" id="blog">
<tr>
<td class="titlebg" height="26" align="center">Referrals</td>
</tr>
<tr>
<td class="windowbg">';

// 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>';

echo '
</td>
</tr>
</table>
<br />';
Working on New Mods & Themes for SMF... Will update soon... My Blog page
My Smf forum : Discuss ITAcumens :: My SMF Forum

Fustrate

      // The Referral Mod - Author - YodaOfDarkness
           
      echo '
         <table border="0" cellpadding="4" cellspacing="1" class="bordercolor" width="100%" id="blog">
         <tr>
            <td class="titlebg" colspan="2" height="26" align="center">Referrals</td>
         </tr>';
               
      // 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>';   
     
      echo '
               </td>
            </tr>
         </table>
         <br />';

Steven Hoffman
Former Team Member, 2009-2012

Sudhakar Arjunan

Got Seated Perfectly.

Thanks a lot Author for this kind help.

Even thank a lot for the excellent mod too.
Working on New Mods & Themes for SMF... Will update soon... My Blog page
My Smf forum : Discuss ITAcumens :: My SMF Forum

stanwww

I try the mod in v.1.1.5. But, the mod does not work. Nothing changes in the profile area. Anyone may help?

Stanley

Fustrate

Are you using a custom theme? You'll need to make the theme edits in your custom theme's Profile.template.php following the guidelines on the page found at...

http://custom.simplemachines.org/mods/index.php?mod=1114
Look under "Download This Mod"
Select the first radio button on the right side, next to "Referrals_Mod_v2.0.1.zip (15KB)"
Select "1.1.5" from the dropdown list underneath those options
And on the following page, search for "Profile.template.php"

Damn, they really need to let us link directly to the instructions page...
Steven Hoffman
Former Team Member, 2009-2012

edi67

CrazyZone - My SMF Forum


From the difficult the hardening of the man you can see

ke4obt

maybe I missed it, but when it comes to showing the URL and the copy button, I want it so that only the Admin and the user who's profile it's on will see that - not another user.
My forum is basically closed - you don't see diddly squat unless you log in, so the referral for a "new" user isn't going to be used FROM the site. I'd like it so that the registered user can see/copy his own referral URL to paste it in his/her e-mail, blog, etc. But also, so that the referrals tally is still showing in their profile. I don't want Johnny being able to see Jimmy's referral URL, much less copy it.
Does this make sense? Is it possible? Please tell me it's possible AND not too difficult to do!! :D
Thanks in advance,
Flip
Thanks Much

Flip - KE4OBT
     The Blind Ham
Helping other blind hams
get on the air!


Yes I am really a BLIND user!

So, if a mod doesn't install properly, and I can't get help from your part of the forum,
I will come begging for YOUR help since you wrote it and know how it works
um, uh, well,
At least I would really, really hope you do!
HEE-HEE-HEE

Aeoni

I'm using this mod whilst using the Ultimate Profile mod.

The code has been added to UltimateProfile.template.php to make the referrer information show, but the background for the newly added referrer area is a different colour to the rest of the ultimate profile.

Any suggestions?

(php file attached)

Respect To
Sabre™ | YodaOfDarkness | spearfish | Neorics | [SiNaN]

please note: if I request a mod or a service, you MUST accept PayPal or Xoom

Fustrate

Steven Hoffman
Former Team Member, 2009-2012

Aeoni

Flawless. Correct colour, and the individual elemts, like pictures, media etc now line up correctly.


Thanks :)

Respect To
Sabre™ | YodaOfDarkness | spearfish | Neorics | [SiNaN]

please note: if I request a mod or a service, you MUST accept PayPal or Xoom

Fustrate

Sorry for the one-word post, had to rush off to class (and now I have to rush off to work :D)

Glad to hear it worked
Steven Hoffman
Former Team Member, 2009-2012

CorpRebel

Probably a silly question but ...

I just installed this Referrals Mod v2.0 thru the SMF pkg installer feature. Everything seemed to install okay. It (the referral link) shows up in my test profile.

Is there an admin type control panel for this mod in the SMF admin area so I can see who does the most referrals? I'm not having any luck finding one in my admin area. I need to see everyone's referral stats or this mod becomes unusable to me.

Thanx!

Rick aka CorpRebel  8)

P.S. Just want to say thanx to you guys and gals that put out all these mods. They're VERY helpful! Alot more organized here.

Fustrate

So you want a list, 50 to a page, of your members ordered by how many referrals they have? I've been meaning to add that into the code... might as well, seeing how it's gotten a few requests.

For now, there are two little stat boxes added in your forum statistics page, which list the top fives.
Steven Hoffman
Former Team Member, 2009-2012

CorpRebel

Quote from: YodaOfDarkness on September 07, 2008, 10:58:34 AM
So you want a list, 50 to a page, of your members ordered by how many referrals they have? I've been meaning to add that into the code... might as well, seeing how it's gotten a few requests.

That would be super KOOL for what I'm gonna be using it for. It helps the admin keep track of users that bring visitors to the site. Thx!

QuoteFor now, there are two little stat boxes added in your forum statistics page, which list the top fives.

Being new to the SMF software, I guess I need to look for this. heh heh


Thanx Again!

Rick aka CorpRebel  8)

chadon

#196
It seems there is a problem with the package files in the download section. I can't see the preview images and can't download the zip file.
Sorry Simple machines must be down. No mod or theme can be downloaded.

enigma87

I would like to make a page with banners that have the referral links automaticlally in the html code i give with each banner. So can u tell me where i need to get the referral link for each user from?

Fustrate

Either go to their profile (it's in the front page of it) or if you have their user ID, the link is http://www.yoursite.com/forum/index.php?referredby=123 where 123 is their user ID.
Steven Hoffman
Former Team Member, 2009-2012

enigma87

Oops I know how to see another user's referral link, I wanna code a page such that, when i visit the banners page, the banner html code shows my referral link, When another person does that, he sees his own referral link... So i need the variable that gives "referredby=$something" where $something is the user's ID. I tried to look thru profile.php and i could not find where the code for printing out the referral link is....

Advertisement: