Mysidia Adoptables Support Forum  

Home Community Mys-Script Creative Off-Topic
Go Back   Mysidia Adoptables Support Forum > Mysidia Adoptables > Questions and Supports

Notices

Reply
 
Thread Tools Display Modes
  #1  
Old 03-19-2017, 12:27 PM
Abronsyth's Avatar
Abronsyth Abronsyth is offline
A Headache Embodied
 
Join Date: Aug 2011
Location: NY
Posts: 1,011
Gender: Male
Credits: 111,670
Abronsyth is on a distinguished road
Default Function add on a non-object issue

Hey all, hoping someone more PHP savvy than myself can help out here.

I'm working on adding a new module to my theme and am basing it off of the other modules. Well, I am encountering an issue now in my class file.
Quote:
Fatal error: Call to a member function add() on a non-object in /home/teratria/public_html/classes/class_userbar.php on line 56
This is the script that it is struggling with;
PHP Code:
    protected function setUsercp(){
    
$mysidia Registry::get("mysidia");
        
$profile $mysidia->user->getprofile(); 
    
date_default_timezone_set("America/New_York");
    
$time date('h:i a');
        
//$this->UserCP->add(new Comment("<img src='http://teratria.x10host.com/images/theme/clock.png'/> {$time}"));
        
$profileLink = new Link("http://teratria.x10host.com/profile/view/{$mysidia->user->username}");
        
$profileLink->setText("<img src='http://teratria.x10host.com/images/theme/user.png'/> {$mysidia->user->username}");
        
$this->usercp->add($profileLink);
        
        
$this->setDivision($this->usercp);    
    } 
Is anyone able to see what I am doing wrong?
__________________
My Mods Site (1.3.4, 2020 Mods)
Reply With Quote
  #2  
Old 03-19-2017, 03:26 PM
Silver_Brick Silver_Brick is offline
Designer || Coder
 
Join Date: Oct 2016
Location: In Earth
Posts: 205
Gender: Male
Credits: 26,122
Silver_Brick is on a distinguished road
Default

are you making a userbar ?? i could help you to make it
Reply With Quote
  #3  
Old 03-19-2017, 03:51 PM
Abronsyth's Avatar
Abronsyth Abronsyth is offline
A Headache Embodied
 
Join Date: Aug 2011
Location: NY
Posts: 1,011
Gender: Male
Credits: 111,670
Abronsyth is on a distinguished road
Default

Sort of, yes, I am making a user control panel that is a separate widget from the sidebar.

If I could just get the function working properly then everything else would be fine, so I already have everything coded, just need to find out what's causing my function to bug out.
__________________
My Mods Site (1.3.4, 2020 Mods)
Reply With Quote
  #4  
Old 03-19-2017, 05:57 PM
Hall of Famer's Avatar
Hall of Famer Hall of Famer is offline
Administrator, Lead Coder
 
Join Date: Dec 2008
Location: South Brunswick
Posts: 4,448
Gender: Male
Credits: 327,410
Hall of Famer is on a distinguished road
Default

Well seems to me that this is where you get the error:

PHP Code:
$this->usercp->add($profileLink); 
If so, you have uninitialized property $usercp for your class, or this property does not exist(a typo, or it never exists in the first place). You need to provide more information here, maybe posting the entire class file will do.
__________________


Mysidia Adoptables, a free and ever-improving script for aspiring adoptables/pets site.
Reply With Quote
  #5  
Old 03-19-2017, 10:21 PM
Abronsyth's Avatar
Abronsyth Abronsyth is offline
A Headache Embodied
 
Join Date: Aug 2011
Location: NY
Posts: 1,011
Gender: Male
Credits: 111,670
Abronsyth is on a distinguished road
Default

I couldn't wrap my head around it, but I found an alternative solution following Kyttias's code bits here;
http://mysidiaadoptables.com/forum/s...ead.php?t=4599

Thanks y'all for the replies!
__________________
My Mods Site (1.3.4, 2020 Mods)
Reply With Quote
  #6  
Old 03-19-2017, 11:13 PM
Silver_Brick Silver_Brick is offline
Designer || Coder
 
Join Date: Oct 2016
Location: In Earth
Posts: 205
Gender: Male
Credits: 26,122
Silver_Brick is on a distinguished road
Default

it can be done in template.tpl of template file ^^ but first assign the variables ^^
Reply With Quote
Reply

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 09:54 AM.

Currently Active Users: 92 (0 members and 92 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