PDA

View Full Version : Promo Codes


SilverDragonTears
06-29-2012, 02:10 PM
Why is it that I can't let each user on the site use the same promo code once each? I want to give everyone an item but only let them get it once each by entering the same promo code. How can I achieve this?

SilverDragonTears
06-29-2012, 02:58 PM
I assume it's this part?



private function checknumber(){
$data = $GLOBALS['adopts']->select("messages", array(), "touser='{$loggedinname}' and status='unread'")->fetchAll();

if($this->availability == 0){
// The promocode has been used, so it is unavailable now...

$this->message .= "The promocode has been used before and is now unavailable. Please contact the admin if you believe this is a mistake.<br>";
return FALSE;
}
else return TRUE;
}

Hall of Famer
06-30-2012, 01:22 PM
Well because the way this system is designed does not support advanced usage of public promocodes. And in fact to make a promocode available for each user only once, it will require a bit more coding than I had envisioned at the very beginning. You need to create a field in your database table prefix.promocodes to keep track of a list of users who have used this specific promocode. It may not be difficult, but sure can be tedious.