Adding Premium Currency
First of all, follow
this tutorial to add premium currency to your site
Then in
admincp/view/promoview.php, add this line...
PHP Code:
$typesList->add(new RadioButton("Premium Currency", "type", "Premium Currency"));
...in both the add() and edit() sections. (Use the previous part of this tutorial for guidance)
Then in
classes/class_promocode.php, add this...
PHP Code:
case "Premium Currency":
// The user will receive premium currency from the promocode now.
$premiumcost = $mysidia->settings->premiumcurrency; //The name of your site's premium currency
$premiumcash = $mysidia->db->select("users", array("premiumcurrency"), "username ='{$mysidia->user->username}'")->fetchColumn(); //How much premium currency the user has
$new_premiumcash = $premiumcash + $this->reward; //Simple sum to calculate user's current cash + reward
$mysidia->db->update("users", array("premiumcurrency" => $new_premiumcash), "username ='{$mysidia->user->username}'"); //Update the database with the new premium currency amount
$document->addLangvar("Congrats, you have acquired {$this->reward} {$premiumcost} by entering promocode.");
$this->usepromo();
break;
...underneath the currency section you just added. (It should go under the
break;)
Make sure you look through the code and see if it matches up with your own database! If you named the premium currency field (for example) anything other than 'premiumcurrency' while adding it to your site, you might have to tweak it. I'm willing to help if you need it, just comment below.
Also, this doesn't go over tweaking the descriptions that show up to say you can add currency now. That should be easy enough to do by just finding those lines in
promoview.php yourself and making it say whatever you want it to!
I hope this helps someone! It's very simple but I was quite proud of myself for managing it with no help lol.