tripleM Posted October 5, 2009 Share Posted October 5, 2009 Hi, I am getting this error from login page. Fatal error: Call to a member function getUserLogin() on a non-object Code Snippet:- function UsersGetMyLogin() { global $UsersAuth; return $UsersAuth->getUserLogin(); //here the error Could you please help me out? Thanks, tripleM Quote Link to comment https://forums.phpfreaks.com/topic/176528-fatal-error-call-to-a-member-function-getuserxxx-on-a-non-object/ Share on other sites More sharing options...
jon23d Posted October 5, 2009 Share Posted October 5, 2009 $UsersAuth is not an object. You make it available with global, but where is it defined? What is it? Quote Link to comment https://forums.phpfreaks.com/topic/176528-fatal-error-call-to-a-member-function-getuserxxx-on-a-non-object/#findComment-930545 Share on other sites More sharing options...
tripleM Posted October 5, 2009 Author Share Posted October 5, 2009 Its defined in another php like $UsersAuthMethod = SetupVar("UsersAuthMethod"); include_once($RootDir.$Plugins["Users"]->Dir."UsersAuth{$UsersAuthMethod}.php"); $UsersAuthMethodObjectName = "UsersAuth{$UsersAuthMethod}"; $UsersAuth = new $UsersAuthMethodObjectName(); Quote Link to comment https://forums.phpfreaks.com/topic/176528-fatal-error-call-to-a-member-function-getuserxxx-on-a-non-object/#findComment-930559 Share on other sites More sharing options...
jon23d Posted October 5, 2009 Share Posted October 5, 2009 Okay, so after $UsersAuth = new $UsersAuthMethodObjectName(); Add in echo "\$UsersAuth = new $UsersAuthMethodObjectName();<br />"; To see what is being instantiated, you can also print_r($UsersAuth) to get an idea. Quote Link to comment https://forums.phpfreaks.com/topic/176528-fatal-error-call-to-a-member-function-getuserxxx-on-a-non-object/#findComment-930583 Share on other sites More sharing options...
tripleM Posted October 5, 2009 Author Share Posted October 5, 2009 Thanks Jon, that line is not reachable. Please let me know the significance of include_once($DirStarfish.$Plugins["Users"]-> Dir."UsersAuth{$UsersAuthMethod}.php"); After UserAuth{$UsersAuthMethod}.php. What is this? Quote Link to comment https://forums.phpfreaks.com/topic/176528-fatal-error-call-to-a-member-function-getuserxxx-on-a-non-object/#findComment-930610 Share on other sites More sharing options...
jon23d Posted October 6, 2009 Share Posted October 6, 2009 I have no idea what the contents of the referenced file are. Why is the line unreachable??? Quote Link to comment https://forums.phpfreaks.com/topic/176528-fatal-error-call-to-a-member-function-getuserxxx-on-a-non-object/#findComment-931265 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.