pixelusin Posted March 21, 2010 Share Posted March 21, 2010 I'm running the ELGG Social Networking software and seem to be having a problem with a mod. This is the error message that I am getting when I click on the register link: *** Fatal error: Call to a member function getObjects() on a non-object in /home/content/l/e/s/lesbionix/html/mod/customstyle/start.php on line 70 *** and this is the line in question: *** $customstyle_object = $user->getObjects($metadata_name, 1, 0); *** I get this error when I try and register to the site. I'm running a "siteaccess mod" that allows me to "wall off" the site and require a password. The "customstyle mod" is a mod that allows users to "pimp their profiles." Yeah, I know, one shouldn't have ANYTHING to do with the other, but this is the situation I am having! Any help you all could give me would be greatly appreciated. I posted the question in the ELGG forum and got NOTHING! Hopefully you all can help me! Thanks in advance for the help, Tami Quote Link to comment https://forums.phpfreaks.com/topic/195973-crazy-php-error/ Share on other sites More sharing options...
pixelusin Posted March 29, 2010 Author Share Posted March 29, 2010 Maybe I've been asking the question the wrong way? I was hoping someone could tell me what's wrong with this line of code as it pertains to the Customstyle plugin. When I click on the Register button, I get this error message: Fatal error: Call to a member function getObjects() on a non-object in /home/content/l/e/s/lesbionix/html/mod/customstyle/start.php on line 70 And heres line 70 from the Start.php file" $customstyle_object = $user->getObjects($metadata_name, 1, 0); line: 70 This is the rest of that code" function get_custom_style_from_metadata($user, $metadata_name){ $returnArray = false; $user = get_entity($user); line: 70 $customstyle_object = $user->getObjects($metadata_name, 1, 0); $customConfig = get_metadata_for_entity($customstyle_object[0]->guid); if($customConfig){ foreach($customConfig as $metadataObject){ $returnArray[$metadataObject['name']] = $metadataObject['value']; } } return $returnArray; } If I disable the CustomStyle plugin the problem goes away. Any ideas as to what might be the problem? I'd appreciate the help! Quote Link to comment https://forums.phpfreaks.com/topic/195973-crazy-php-error/#findComment-1033365 Share on other sites More sharing options...
trq Posted March 29, 2010 Share Posted March 29, 2010 The problem is that $user is not an object. Where is $user defined? Quote Link to comment https://forums.phpfreaks.com/topic/195973-crazy-php-error/#findComment-1033368 Share on other sites More sharing options...
pixelusin Posted March 30, 2010 Author Share Posted March 30, 2010 Thorpe, I understand your question but I'm not sure how or where to find the information you are asking about. The error occurs when someone clicks on the Register link. Would that be a place to start looking for the place where $user defined might be? I'm not the most knowledgeable about PHP. Quote Link to comment https://forums.phpfreaks.com/topic/195973-crazy-php-error/#findComment-1033898 Share on other sites More sharing options...
pixelusin Posted March 31, 2010 Author Share Posted March 31, 2010 Thorpe, Is this the line of code you were referring to? if (($user = get_user_by_username($username)) && !$user->validated) { Where$user would be $username? I'm really not very good at PHP! Thanks, Tami Quote Link to comment https://forums.phpfreaks.com/topic/195973-crazy-php-error/#findComment-1034555 Share on other sites More sharing options...
PFMaBiSmAd Posted March 31, 2010 Share Posted March 31, 2010 The following line of code is what appears to be responsible for setting $user to an instance of an object (immediately before the line where the error is occurring) - $user = get_entity($user); It would take seeing the code in the get_entity() function to be sure, but it may be intentionally returning a FALSE value instead of an object and the main code should be testing for that occurrence instead of blindly using the returned value. It also may be that there is a logic error in the get_entity() function that needs to be fixed. Quote Link to comment https://forums.phpfreaks.com/topic/195973-crazy-php-error/#findComment-1034607 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.