Mys 1.3.4 Enable/Disable Daily clicks for the users

Forum
Last Post
Threads / Messages

kristhasirah

Member
Member
Joined
Jan 22, 2010
Messages
197
Points
16
Location
In middle of the nothingness
Mysidian Dollar
20,995
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:
nl40UyI.png


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:
		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:
           $levelUser = clone $levelSystem;
you will add below this:
PHP:
		$levelLinumber = clone $levelSystem;

then look for
PHP:
                     ->buildComment("Maximum Number of adoptables allowed for daily clicks:   ", FALSE)->buildTextField("number", $levelSettings->number)
on top of it you will add this:
PHP:
					 ->buildComment("Enable or disable the daily clicks:	", FALSE)->buildRadioList("linumber", $levelLinumber, $levelSettings->linumber)
in the end it should look like this:
PHP:
        $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:
  elseif($mysidia->user->getVotes() > $this->settings->number) throw new LevelupException("number");
and replace with:
PHP:
 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
 

Similar threads

Users who are viewing this thread

  • Forum Contains New Posts
  • Forum Contains No New Posts

Forum statistics

Threads
4,277
Messages
33,118
Members
1,602
Latest member
BerrieMilk
BETA

Latest Threads

Latest Posts

Top