Author Topic: Combinding with the invite mod  (Read 8935 times)

Offline grusomhat

Combinding with the invite mod
« on: February 05, 2007, 02:28:39 pm »
I was wondering if you would be able to make the shop work with this mod http://www.smfhacks.com/hacks/Invite-registration-through-invitation.html So that when someone joins through the invite it gives the user who invited them some points? I am sure this won't be too difficult as most of the coding is probably done, it's just needing to be combined.

Thanks for any help you have.

Offline ron

Re: Combinding with the invite mod
« Reply #1 on: February 06, 2007, 03:07:53 pm »
I am also looking for this kind of affiliate program with SMF Shop. People can join through a 'special' url ( eg. www.yourdomain.com/forum/index.php?ref=YourUsername) and earn credits. and for every post that this new member does, you get 10% of the points that the member you refered did.

This can be seen in this forum: http://www.webdigity.com/

They are using SMF Shop mod, and an affiliate mod. Anyone know how to merge this two mod?  ???

Offline Daniel15

Re: Combinding with the invite mod
« Reply #2 on: February 10, 2007, 01:57:10 pm »
Minor typo in feeble's code: Change $getOD to $getID ;)

Offline Maniakc

Re: Combinding with the invite mod
« Reply #3 on: February 25, 2007, 10:46:15 am »
Im having a lot of trouble on my forum with this mod, is there any way to do this with the affiliate mod?
http://custom.simplemachines.org/mods/index.php?mod=287

Offline feeble

Re: Combinding with the invite mod
« Reply #4 on: February 25, 2007, 12:42:01 pm »
Im having a lot of trouble on my forum with this mod, is there any way to do this with the affiliate mod?
http://custom.simplemachines.org/mods/index.php?mod=287

this mod was last worked on in april of last year, i really would look somewhere else.  also this package format is old as well.

Offline Maniakc

Re: Combinding with the invite mod
« Reply #5 on: February 25, 2007, 11:54:23 pm »
Meh, I just dont like the invite one, so Im gonna use the Affiliates mod.
« Last Edit: February 26, 2007, 09:05:28 am by Maniakc »

Offline preddy25

Re: Combinding with the invite mod
« Reply #6 on: April 28, 2007, 03:19:12 pm »
for anyone who wants to use this  , you need to do some modification ,becoz the new invite mod has extra fields so do not replace them like in feeble post.

copy n replace this instead 

// Invite MOD; looks like registration went ok, let's mark the invite key as used and who it was used by.
   if ($context['invite_key'] !== false)
   {
      db_query("
         UPDATE {$db_prefix}invites
         SET ID_REGISTRATION = '$memberID'
         WHERE inviteKey = '{$context['invite_key']}'
         LIMIT 1", __FILE__, __LINE__);
   }
   elseif (!empty($_REQUEST['inviter']) && (int)$_REQUEST['inviter'] !== 0)
   {
      db_query("
         INSERT INTO {$db_prefix}invites (ID_MEMBER, ID_REGISTRATION, inviteTime)
         VALUES ('" . (int)$_REQUEST['inviter'] . "', '$memberID', " . time() . ")
         ", __FILE__, __LINE__);

      $getID = mysql_fetch_assoc(db_query("
      SELECT ID_MEMBER
      FROM {$db_prefix}invites
      WHERE inviteKey = '$invite_key'
      LIMIT 1", __FILE__, __LINE__));

      if ($getID)
      {
         $ID = $getID['ID_MEMBER'];
         $addMoney = 100;
         db_query("
         UPDATE {$db_prefix}members
         SET money = money + '$addMoney'
         WHERE ID_MEMBER = '$ID'
         LIMIT 1", __FILE__, __LINE__);
      }


   }

Feeble ,  can we just replace the money fields and put into good karma ?is that easy?

Offline feeble

Re: Combinding with the invite mod
« Reply #7 on: April 28, 2007, 09:32:53 pm »
I deleted my post above, to cut confusion.

to change karma instead of money

just replace 'money' with 'karmaGood'

Offline preddy25

Re: Combinding with the invite mod
« Reply #8 on: April 29, 2007, 12:25:24 pm »
i think made some error in the above posts :D ... feeble can u help me see if the code below is correct? i cant get it to work anymore...took the whole day to troubleshoot but cant seem to find out why this code is not updating anymore....



// Invite MOD; looks like registration went ok, let's mark the invite key as used and who it was used by.
   if ($context['invite_key'] !== false)
   {
      db_query("
         UPDATE {$db_prefix}invites
         SET ID_REGISTRATION = '$memberID'
         WHERE inviteKey = '{$context['invite_key']}'
         LIMIT 1", __FILE__, __LINE__);

     }
   elseif (!empty($_REQUEST['inviter']) && (int)$_REQUEST['inviter'] !== 0)
   {
      db_query("
         INSERT INTO {$db_prefix}invites (ID_MEMBER, ID_REGISTRATION, inviteTime)
         VALUES ('" . (int)$_REQUEST['inviter'] . "', '$memberID', " . time() . ")
         ", __FILE__, __LINE__);

       if ($getID)
      {
         $ID = $getID['ID_MEMBER'];
         $addMoney = 100;
         db_query("
         UPDATE {$db_prefix}members
         SET money = money + '$addMoney'
         WHERE ID_MEMBER = '$ID'
         LIMIT 1", __FILE__, __LINE__);
      } 
       
   }

Offline feeble

Re: Combinding with the invite mod
« Reply #9 on: April 29, 2007, 12:31:29 pm »
without looking at your forum error log
possibly you forgot to include
      $getID = mysql_fetch_assoc(db_query("
      SELECT ID_MEMBER
      FROM {$db_prefix}invites
      WHERE inviteKey = '$invite_key'
      LIMIT 1", __FILE__, __LINE__));

Offline preddy25

Re: Combinding with the invite mod
« Reply #10 on: April 29, 2007, 02:40:28 pm »
This is the original modification done by the invite mod on register.php....i think my original hack was wrong coz even i used the original hack , only administrator sending out invites geta accrediated but the rest of the others do not , even after they are upgraded to admin permissions. weird! i check the forum logs there isnt any associated error logs with regards to this . And it works on administrator accounts only without the use of invite_keys , where the returning address for referals would like like
http://192.168.1.200/forums/index.php?action=register;inviter=1 ( inviter=1 would be administrator)
but if using keys it would use the key to find out whats the member_id ..
http://192.168.1.200/forums/index.php?action=register;invite_key=5ae9080878e45ce40807209601c975a343308cc8
i think thats where it gets confusing for me...the entries are all right in sql database..the invite mod works find it just that updating points n karma doesnt work properly..



Original 
// Invite MOD; looks like registration went ok, let's mark the invite key as used and who it was used by.
   if ($context['invite_key'] !== false)
   {
      db_query("
         UPDATE {$db_prefix}invites
         SET ID_REGISTRATION = '$memberID'
         WHERE inviteKey = '{$context['invite_key']}'
         LIMIT 1", __FILE__, __LINE__);
   }
   elseif (!empty($_REQUEST['inviter']) && (int)$_REQUEST['inviter'] !== 0)
   {
      db_query("
         INSERT INTO {$db_prefix}invites (ID_MEMBER, ID_REGISTRATION, inviteTime)
         VALUES ('" . (int)$_REQUEST['inviter'] . "', '$memberID', " . time() . ")
         ", __FILE__, __LINE__);
   }