KatFennec |
04-25-2017 07:48 PM |
Quote:
Originally Posted by Abronsyth
(Post 36202)
That is certainly curious, I have the favpet in my sidebar (and elsewhere on my site) using Kyttias's code without any issues.
Did you make sure to leave the code sections in the widget blank? The widget only exists for you to actually place within the sidebar, but no code goes into it via the ACP.
|
Yes, I did. I copied the code that Kyttias provided, pasted it into class_sidebar.php as per the instructions, then created a blank module, with the name FavPetSB, exactly as per instructions.
As it stands, I have the following code, emplaced within the PHP box of a new module. However, it seems that the if statement is causing some manner of issue - it works flawlessly if the user HAS set a favourite pet, but the entire site returns a 500 error if not, and they are logged in.
PHP Code:
$profile = $mysidia->user->getprofile(); $owned = new OwnedAdoptable($profile->getFavpetID());
if($profile->getFavpetID() == 0){ $texta = new Paragraph; $texta->add(new Comment(" <br> Unfortunately, you don't seem to have a favourite pet set. ")); } else { $Name = $owned->getName(); $Type = $owned->getType(); $texta = new Paragraph; $texta->add(new Comment("
<br> <img src='{$owned->getImage()}'> <br> {$Name} the {$Type} <br> <a href='{$mysidia->path->getAbsolute()}myadopts/manage/{$owned->getAdoptID()}'>View</a> | <a href='{$mysidia->path->getAbsolute()}account/profile'>Change</a> ")); } $moduleContainer->add($texta);
EDIT: I should mention we have Mysidia installed in a subdomain, and on x10hosting, on the offhand chance either of those are contributing factors
|