View Single Post
  #1  
Old 08-05-2020, 11:50 AM
kristhasirah's Avatar
kristhasirah kristhasirah is offline
Member
 
Join Date: Jan 2010
Location: In middle of the nothingness
Posts: 196
Gender: Female
Credits: 28,432
kristhasirah
Default Enable/Disable Daily clicks for the users

i think the daily click is a useful function, but when you have a small site or have limited the daycare to show only some levels or give really small amounts of money for each click... it seems not so needed...
the temporal solution was to increase the number to the amount of current owned adoptables. But someone asked in the chat if there was a way to disable the option... the easy way was to remove the code that gives the error once you reached the limit... but if one day you want to enable the daily click you have to add that code again. So after looking at the code i came with the idea of adding an enable and disable option.

first you need to insert a new row in the levels_settings table in the database
name: linumber
value: disabled
should look similar to this:


now open your level.php in the admincp folder and search for: public function settings(){

you will add: , 'linumber' after 'user'
it should look like this:
PHP Code:
        if($mysidia->input->post("submit")){
            
$settings = array('system''method''maximum''clicks',  
                              
'number''reward''owner''user''linumber'); 
save the file and now open levelview.php in the view folder of admincp
look for:
PHP Code:
           $levelUser = clone $levelSystem
you will add below this:
PHP Code:
        $levelLinumber = clone $levelSystem
then look for
PHP Code:
                     ->buildComment("Maximum Number of adoptables allowed for daily clicks:   "FALSE)->buildTextField("number"$levelSettings->number
on top of it you will add this:
PHP Code:
                     ->buildComment("Enable or disable the daily clicks:    "FALSE)->buildRadioList("linumber"$levelLinumber$levelSettings->linumber
in the end it should look like this:
PHP Code:
        $levelOwner = clone $levelSystem;
        
$levelUser = clone $levelSystem;
        
$levelLinumber = clone $levelSystem;
        
        
$settingsForm->buildComment("Level-Clicks System Enabled:   "FALSE)->buildRadioList("system"$levelSystem$levelSettings->system)
                     ->
buildComment("Level-Clicks Mechanism:   "FALSE)->buildRadioList("method"$levelMethod$levelSettings->method)
                     ->
buildComment($this->lang->method_explain)
                     ->
buildComment("Max-Level allowed for all Species:     "FALSE)->buildTextField("maximum"$levelSettings->maximum)                 
                     ->
buildComment("Required Clicks Patterns:   "FALSE)->buildTextField("clicks", ($levelSettings->clicks)?implode(","$levelSettings->clicks):"")
                     ->
buildComment($this->lang->clicks_explain)
                     ->
buildComment("Enable or disable the daily clicks:    "FALSE)->buildRadioList("linumber"$levelLinumber$levelSettings->linumber)
                     ->
buildComment("Maximum Number of adoptables allowed for daily clicks:   "FALSE)->buildTextField("number"$levelSettings->number)
                     ->
buildComment($this->lang->number_explain)
                     ->
buildComment("Min and Max Money Reward for clicking adoptables(separate by comma):    "FALSE)->buildTextField("reward"implode(","$levelSettings->reward))
                     ->
buildComment("Allow Users to click their own pets:    "FALSE)->buildRadioList("owner"$levelOwner$levelSettings->owner)    
                     ->
buildComment($this->lang->owner_explain)    
                     ->
buildComment("Allow Users to click all the pets:    "FALSE)->buildRadioList("user"$levelUser$levelSettings->user)    
                     ->
buildComment($this->lang->user_explain)             
                     ->
buildButton("Change Level Settings""submit""submit");
        
$document->add($settingsForm); 
save and now open levelup.php in the public folder
look for
PHP Code:
  elseif($mysidia->user->getVotes() > $this->settings->number) throw new LevelupException("number"); 
and replace with:
PHP Code:
 elseif($mysidia->user->getVotes() > $this->settings->number and $this->settings->linumber == "enabled") throw new LevelupException("number"); 
and you are done, you can now enable or disable the daily clicks from the admincp
__________________
Reply With Quote