Mysidia Adoptables Support Forum  

Home Community Mys-Script Creative Off-Topic
Go Back   Mysidia Adoptables Support Forum > Mysidia Adoptables > Addons and Modifications > Mys v1.3.x Mods

Notices

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 05-12-2017, 02:59 AM
KatFennec's Avatar
KatFennec KatFennec is offline
Member
 
Join Date: Apr 2017
Posts: 57
Gender: Female
Credits: 7,633
KatFennec is on a distinguished road
Default Public Profile Mod

The following is a mod that extends the functionality of levelup.php to create a profile for each pet, viewable by other users.



This mod is heavily based on code provided by Kyttias

To get started, open levelup.php and change
PHP Code:
if($mysidia->input->action() == "click" or $mysidia->input->action() == "siggy" $this->adopt = new OwnedAdoptable($mysidia->input->get("aid")); 
to
PHP Code:
if($mysidia->input->action() == "click" or $mysidia->input->action() == "siggy" or $mysidia->input->action() == "publicprofile"$this->adopt = new OwnedAdoptable($mysidia->input->get("aid")); 
, t
at the bottom paste the following:
PHP Code:
public function publicprofile(){
#begin profile code
$mysidia Registry::get("mysidia");
$date = new DateTime;
$this->setField("adopt"$this->adopt);
$ip secure($_SERVER['REMOTE_ADDR']); 
Next, open levelupview.php, found in your views folder.
again, scroll down to the bottom and paste:
PHP Code:
public function publicprofile(){
            
$mysidia Registry::get("mysidia");
            
$adopt $this->getField("adopt");            
            
$adoptcurrentlevel $adopt->currentlevel;
            
$document $this->document;
            
$document->setTitle("Viewing {$adopt->getName()}'s profile");
        if(
$adopt->hasNextLevel()){
            
$nextLevel $adopt->getNextLevel();
            
#$requiredClicks = $nextLevel->getRequiredClicks();
$thisisauniqueid = new OwnedAdoptable($adopt->getAdoptID());
$gender_lookup $mysidia->db->select("owned_adoptables", array("gender"), "aid = '{$adopt->getAdoptID()}'")->fetchColumn();
if (
$gender_lookup == "m") { $gender "Male"$pronoun "him"; } else { $gender "Female"$pronoun "her"; } 
$alternates_lookup $mysidia->db->select("owned_adoptables", array("usealternates"), "aid = '{$adopt->getAdoptID()}'")->fetchColumn();
if (
$mysidia->user->username == $adopt->getOwner()){ $manage_btn "<a class='btn btn-sm btn-info' href='../../myadopts/manage/{$adopt->getAdoptID()}'><i class='fa fa-gear'></i> Manage</a>"; } else { $manage_btn ""; }

if(
$adopt->hasNextLevel()){
$level $adopt->getNextLevel();
$levelupClicks $adopt->getLevelupClicks();
$document->add(new Comment("(LVL ".$level->getLevel()." in ".$levelupClicks." more EXP)")); 
}
else { 
$document->add(new Comment("(MAX)")); }

if(
$adopt->getTradeStatus() == "fortrade") { $tradestatus "<b>For Trade</b>"; } 
else { 
$tradestatus "<b>Not For Trade</b>"; }



// If you've already seen the pet today:
if ($adopt->hasVoter($mysidia->user$date)){
$document->add(new Comment("<a class='btn btn-sm btn-info disabled' href='../../levelup/click/{$adopt->getAdoptID()}'><i class='fa fa-paw'></i> Already Fed</a>"));
}
// If you haven't seen the pet today:
else {
$document->add(new Comment("<a class='btn btn-sm btn-info' href='../../levelup/click/{$adopt->getAdoptID()}'><i class='fa fa-paw'></i> Feed</a>"));
};
}
$document->add(new Comment("{$manage_btn}
<br> <br>
<img src='
{$thisisauniqueid->getImage()}'><br>"));
$adoptabletype $mysidia->db->select("adoptables", array(), "type='{$adopt->getType()}'")->fetchObject();
$diet $adoptabletype->Diet;
$level $adopt->getCurrentLevel();
$document->add(new Comment("<ul>
<li>Lives With: <a href='/profile/view/
{$adopt->getOwner()}'>{$adopt->getOwner()}</a></li>
<li>Species: 
{$adopt->getType()}</li>
<li>Gender: 
{$gender}</li>

<li>LVL: 
{$adopt->getCurrentLevel()} {$toNext}</li>
<li>Total EXP: 
{$adopt->getTotalClicks()}</li> 
<li>Trade Status: 
{$tradestatus}</li>

"
));
        } 
This essentially creates a new page under levelup, yoursite.com/levelup/publicprofile/(adoptable ID number), but there isn't anything that links to it yet! We'll fix that next. Open myadoptsview.php and under the line reading
PHP Code:
$document->add(new Link("levelup/click/{$aid}"" LevelUp {$name}"TRUE)); 
,
add
PHP Code:
$document->add(new Link("levelup/publicprofile/{$aid}"" View {$name}'s Profile"TRUE)); 
.

Now you can view your pets' profiles. But what about other people? If you want them to see the pet's info, go back to levelup.php and replace
PHP Code:
$message = ($mysidia->user instanceof Member)?"already_leveled_member":"already_leveled_guest"
with
PHP Code:
$message .= "You already clicked this adoptable today.  Try again tomorrow. <br>
        <a class='btn btn-sm btn-info' href='../../levelup/publicprofile/
{$this->adopt->getAdoptID()}'><i class='fa fa-chevron-left'></i> Back to Profile</a>"
Finally, open class_adoptablehelper.php, in your classes folder, and replace
PHP Code:
public function getLevelupLink(OwnedAdoptable $adopt){    
        return new 
Link("levelup/click/{$adopt->getAdoptID()}"$adopt->getImage("gui")); 
with
PHP Code:
public function getLevelupLink(OwnedAdoptable $adopt){    
        return new 
Link("levelup/publicprofile/{$adopt->getAdoptID()}"$adopt->getImage("gui")); 
And you're done~!
__________________

Last edited by KatFennec; 05-12-2017 at 03:14 AM.
Reply With Quote
 

Tags
profile

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -5. The time now is 02:24 PM.

Currently Active Users: 463 (0 members and 463 guests)
Threads: 4,080, Posts: 32,024, Members: 2,016
Welcome to our newest members, jolob.
BETA





What's New?

What's Hot?

What's Popular?


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
vBCommerce I v2.0.0 Gold ©2010, PixelFX Studios
vBCredits I v2.0.0 Gold ©2010, PixelFX Studios
Emoticons by darkmoon3636