Mysidia Adoptables Support Forum

Mysidia Adoptables Support Forum (http://www.mysidiaadoptables.com/forum/index.php)
-   Tutorials and Tips (http://www.mysidiaadoptables.com/forum/forumdisplay.php?f=27)
-   -   Second Currency (http://www.mysidiaadoptables.com/forum/showthread.php?t=5459)

Fox 05-31-2017 10:14 PM

Second Currency
 
So I see a lot of people asking for a second currency add-on. Well, here's what I did and it seems to be working for me (I'm yet to create a shop with said currency, but will do that when I get home)


Go to MyPHPAdmin

You'll be editing the adopts_settings one.

Open up the SQL query and enter in this.

Quote:

INSERT INTO `adopts_settings`(`name`, `value`) VALUES ('premiumcurrency', 'Your Currency Name')
You can change premiumcurrency to whatever suits you, but please note you'll need to change any future uses of it to what you want it to be.

Next you'll edit the adopts_users.
Go to Structure then add a new column.
I simply checked the money one structure and copied it with the name 'premiumcurrency'. (I'll add a pic when I'm home later)


Now we need to go to your file manager and make some changes.

I wanted to be able to manually add currency through the ACP, so we'll start there.
Go to your adminCP files, and find user.php.

Find this:
Quote:

$mysidia->db->update("users", array("email" => $mysidia->input->post("email")), "uid='{$mysidia->input->get("uid")}'");
$mysidia->db->update("users", array("money" => $mysidia->input->post("money")), "uid='{$mysidia->input->get("uid")}'");

and add beneath it:
Quote:

$mysidia->db->update("users", array("premiumcurrency" => $mysidia->input->post("premiumcurrency")), "uid='{$mysidia->input->get("uid")}'");
Continues to next post as it won't let me post it all at once :/

Fox 06-01-2017 05:12 AM

Now we'll go back and find the settings.php

Find:
PHP Code:

public function globals(){
        
$mysidia Registry::get("mysidia");
        if(
$mysidia->input->post("submit")){
            
$settings = array('theme''sitename''browsertitle''cost',  'slogan''admincontact'
                              
'systemuser''systememail''startmoney'); 

And replace with:
PHP Code:

public function globals(){
        
$mysidia Registry::get("mysidia");
        if(
$mysidia->input->post("submit")){
            
$settings = array('theme''sitename''browsertitle''cost',  'slogan''admincontact'
                              
'systemuser''systememail''startmoney''premiumcost'); 

I simply added my premium cost on the end.

Now go back and into the Admincp View files. Find settingsview.php
Find:
PHP Code:

$document->setTitle($this->lang->basic_title);
        
$document->addLangvar($this->lang->basic);
        
$globalsForm = new FormBuilder("globalsform""globals""post");
        
$globalsForm->buildComment("Default Theme:   "FALSE)->buildTextField("theme"$mysidia->settings->theme)
                    ->
buildComment("Site Name:   "FALSE)->buildTextField("sitename"$mysidia->settings->sitename)
                    ->
buildComment("Site Title:   "FALSE)->buildTextField("browsertitle"$mysidia->settings->browsertitle)
                    ->
buildComment("Currency Name:     "FALSE)->buildTextField("cost"$mysidia->settings->cost)
                    ->
buildComment("Start Money:    "FALSE)->buildTextField("startmoney"$mysidia->settings->startmoney)
                    ->
buildComment("Site Slogan:    "FALSE)->buildTextField("slogan"$mysidia->settings->slogan)
                    ->
buildComment("Admin Email:   "FALSE)->buildTextField("admincontact"$mysidia->settings->admincontact)
                    ->
buildComment("System User:   "FALSE)->buildTextField("systemuser"$mysidia->settings->systemuser)
                       ->
buildComment("System Email:   "FALSE)->buildTextField("systememail"$mysidia->settings->systememail

And add in where suits you (I just added beneath the systememail):
PHP Code:

->buildComment("Premium Currency Name:   "FALSE)->buildTextField("premiumcost"$mysidia->settings->premiumcost

Now let's edit the userview.php
Find:
PHP Code:

$userForm->buildCheckBox(" Delete This User. <strong>This cannot be undone!</strong>""delete""yes")
                     ->
buildComment("Assign New Password: "FALSE)->buildPasswordField("password""pass1"""TRUE)
                     ->
buildComment("Passwords may contain letters and numbers only. Leave the box blank to keep the current password.")
                     ->
buildCheckBox(" Email the user the new password (Only takes effect if setting a new password) ""emailpwchange""yes")
                     ->
buildComment("Change Email Address: "FALSE)->buildTextField("email"$user->getemail())
                     ->
buildComment("Currency: "FALSE)->buildTextField("money"$user->money)
                     ->
buildCheckBox(" Ban this user's rights to click adoptables""canlevel""no")
                     ->
buildCheckBox(" Ban this user's rights to post profile comments""canvm""no")
                     ->
buildCheckBox(" Ban this user's rights to make trade offers""cantrade""no")
                     ->
buildCheckBox(" Ban this user's rights to send friend requests""canfriend""no")
                     ->
buildCheckBox(" Ban this user's rights to breed adoptables""canbreed""no")
                     ->
buildCheckBox(" Ban this user's rights to abandon adoptables""canpound""no")
                     ->
buildCheckBox(" Ban this user's rights to visit Shops""canshop""no"); 

And replace with:
PHP Code:

$userForm->buildCheckBox(" Delete This User. <strong>This cannot be undone!</strong>""delete""yes")
                     ->
buildComment("Assign New Password: "FALSE)->buildPasswordField("password""pass1"""TRUE)
                     ->
buildComment("Passwords may contain letters and numbers only. Leave the box blank to keep the current password.")
                     ->
buildCheckBox(" Email the user the new password (Only takes effect if setting a new password) ""emailpwchange""yes")
                     ->
buildComment("Change Email Address: "FALSE)->buildTextField("email"$user->getemail())
                     ->
buildComment("Currency: "FALSE)->buildTextField("money"$user->money)
->
buildComment("Premium Currency: "FALSE)->buildTextField("premiumcurrency"$user->premiumcurrency)
                     ->
buildCheckBox(" Ban this user's rights to click adoptables""canlevel""no")
                     ->
buildCheckBox(" Ban this user's rights to post profile comments""canvm""no")
                     ->
buildCheckBox(" Ban this user's rights to make trade offers""cantrade""no")
                     ->
buildCheckBox(" Ban this user's rights to send friend requests""canfriend""no")
                     ->
buildCheckBox(" Ban this user's rights to breed adoptables""canbreed""no")
                     ->
buildCheckBox(" Ban this user's rights to abandon adoptables""canpound""no")
                     ->
buildCheckBox(" Ban this user's rights to visit Shops""canshop""no"); 

Again, I just added the premium currency in.

We're all done here, now to make changes to our classes.
Find class_sidebar.php

Find this:
PHP Code:

protected function setMoneyBar(){
        
$mysidia Registry::get("mysidia");
        
$this->moneyBar = new Paragraph;
        
$this->moneyBar->add(new Comment("You have {$mysidia->user->money} {$mysidia->settings->cost}."));
        
        
$donate = new Link("donate");
        
$donate->setText("Donate Money to Friends");
        
$this->moneyBar->add($donate);
        
$this->setDivision($this->moneyBar);        
    } 

Replace with:
PHP Code:

protected function setMoneyBar(){
        
$mysidia Registry::get("mysidia");
        
$this->moneyBar = new Paragraph;
        
$this->moneyBar->add(new Comment("You have {$mysidia->user->money} {$mysidia->settings->cost}.<br>You have {$mysidia->user->premiumcurrency} {$mysidia->settings->premiumcost}."));
        
        
$donate = new Link("donate");
        
$donate->setText("Donate Money to Friends");
        
$this->moneyBar->add($donate);
        
$this->setDivision($this->moneyBar);        
    } 

That's as far as I've gone, I don't think I've missed anything, but I'll add to this when I get home and can create a shop for it.
Hope you find this useful!

Fox 06-01-2017 06:49 AM

turned into a mod with an adopt shop specifically for this currency
Second Currency and Adopt Shop Mod


All times are GMT -5. The time now is 03:27 PM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.