Skip to content

Instantly share code, notes, and snippets.

@danielbitzer
Created October 25, 2016 23:54
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save danielbitzer/015d57920e7c5162d651509b5a0b0556 to your computer and use it in GitHub Desktop.
Save danielbitzer/015d57920e7c5162d651509b5a0b0556 to your computer and use it in GitHub Desktop.
Import referral coupons script
<?php
foreach( $users as $user_id )
{
// fetch the existing key
// please note that the key should NOT include the referral prefix
// so if your prefix is 'REF' then the final coupon here will be 'REF1234'
$key = '1234'
$object = new AW_Model_Referral_Advocate_Key();
$object->advocate_id = $user_id;
$object->created = gmdate( 'Y-m-d H:i:s' );
$object->advocate_key = $key;
$object->save();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment