Author Topic: How to get credits for Referrals (Using Referrals Mod)  (Read 5985 times)

Offline Maniakc

How to get credits for Referrals (Using Referrals Mod)
« on: November 12, 2007, 04:59:01 am »
Many people (like me) want a referral mod in which we can get credits from. I searched around and couldnt find it here, so I looked elsewhere. Anyways, I found something that will work amazingly!

First, install the referrals mod:
http://custom.simplemachines.org/mods/index.php?mod=836

After installing it the usual way through the package manager, use your ftp program to download Register.php from /Sources.

Once you have that file, open it with an editor (like notepad) and find the following line:
Code: [Select]
// updateMemberData((int) $_POST['referredby'], array('money' => 'money + 100',));(the needed code is conveniently already in the mod)

Remove the two slashes and the space after it (// ) and set the 100 to whatever amount of credits you want your members to receive when the referral is signed up. Save the file and upload it to your Sources Folder. (You should back up the other one incase rather than over writing it) Now, when someone is referred using their referral ID, they will get credits and it will show the number of referrals in their profile that they've gotten.

I posted this incase anyone wasn't aware that this could be done so easily! :P

Offline God

Re: How to get credits for Referrals (Using Referrals Mod)
« Reply #1 on: January 30, 2009, 08:24:09 am »
I dont find it...

Here is my code of register.php

Quote
   // Referrals Mod
   // If they emptied it, don't do referral information
   if(!empty($_POST['referredby']))
   {
      // We may need this
      global $context, $sourcedir;
      require_once($sourcedir . '/Referrals.php');

      // If there was a referrer, is it the same one
      if(!empty($context['referrals']) && strtolower($_POST['referredby']) == strtolower($context['referrals']['referred_by_name']))
      {
         $referrer = (int) $context['referrals']['referred_by_id'];
         $regOptions['extra_register_vars']['referred_by'] = $referrer;
         $regOptions['extra_register_vars']['referred_on'] = (int) $context['referrals']['referred_timestamp'];
         $referral = 1;
      }
      else
      {
         // No they changed it, so we've got to find this user
         $referrer = checkReferrerExists($_POST['referredby'], 'name');
                  
         // Referrer by that name not found, so fatal error and force them to check (its better than ignoring it)
         if(empty($referrer))
            fatal_lang_error('referrals_referrer_not_found', false);

Offline Sakae

Re: How to get credits for Referrals (Using Referrals Mod)
« Reply #2 on: June 22, 2009, 10:30:56 am »
I dont find it...

Here is my code of register.php

Quote
   // Referrals Mod
   // If they emptied it, don't do referral information
   if(!empty($_POST['referredby']))
   {
      // We may need this
      global $context, $sourcedir;
      require_once($sourcedir . '/Referrals.php');

      // If there was a referrer, is it the same one
      if(!empty($context['referrals']) && strtolower($_POST['referredby']) == strtolower($context['referrals']['referred_by_name']))
      {
         $referrer = (int) $context['referrals']['referred_by_id'];
         $regOptions['extra_register_vars']['referred_by'] = $referrer;
         $regOptions['extra_register_vars']['referred_on'] = (int) $context['referrals']['referred_timestamp'];
         $referral = 1;
      }
      else
      {
         // No they changed it, so we've got to find this user
         $referrer = checkReferrerExists($_POST['referredby'], 'name');
                  
         // Referrer by that name not found, so fatal error and force them to check (its better than ignoring it)
         if(empty($referrer))
            fatal_lang_error('referrals_referrer_not_found', false);

If you use SMF 2.0 RC1, it's on Sources/Load.php