View Single Post
  #1  
Old 03-07-2016, 02:31 PM
tahbikat's Avatar
tahbikat tahbikat is offline
Member
 
Join Date: Feb 2014
Location: Louisiana
Posts: 408
Gender: Female
Credits: 64,506
tahbikat is on a distinguished road
Default Allow users to delete an adoptable

I'm attempting to make a feature where users can release a pet to the wild, which basically just means permanently deleting it.

I've just copied and modified my pets' bio functions in their myadopts.php and myadoptsview.php to look like below. In class_ownedadoptables.php, I just have a blank public function "doReleasePet()" because I'm honestly just scared to try experimenting with deleting things. :P Afraid I'll end up deleting a whole database table or something lol. Can someone help me out? ;-; Am I going in the right direction at least?

myadopts.php
PHP Code:
public function releasepet(){
    
$mysidia Registry::get("mysidia");        
    if(
$mysidia->input->post("submit")){            
        
$this->adopt->doReleasePet();
    }
    
$this->setField("adopt"$this->adopt);        
    
$this->setField("image"$this->image);            

myadoptsview.php
PHP Code:
public function releasepet(){
    
$mysidia Registry::get("mysidia");
    
$adopt $this->getField("adopt");        
    
$image $this->getField("image");        
    
$document $this->document;
    
    if(
$mysidia->input->post("submit")){
        
$document->setTitle("Successfully Released Pet");
        
$document->add($image);
        
$document->add(new Comment("<br/>You've successfully released your creature to the wild, where it will live out the rest of its days. "));
        return;
    }
    
    
$document->setTitle("Release ".$adopt->getName());
    
$document->add($image);
    
$document->addLangvar("<br/>You can release {$adopt->getName()} to the wilderness here. Are you sure you want to do this?<br/>");
    
    
$releaseButton = new FormBuilder("releasebutton""""post");
    
$releaseButton->buildButton("Release!""submit""submit");
    
$document->add($releaseButton);           

class_ownedadoptables's doReleasePet()
PHP Code:
public function doReleasePet(){


Reply With Quote