modifiedcontent Posted December 5, 2020 Share Posted December 5, 2020 Another very dumb basic question; what could this error mean? Quote Fatal Error: Uncaught Error: Call to a member function isLoggedin() on string in ... Followed by a whole bunch of file addresses. Can someone translate this error; what should I check? I am troubleshooting a custom login/register system. I get this error when I enter gibberish in the username login field to produce a nice 'wrong username or password' message. A 'forgot password' form on the same page, not displayed while logging in, gets the 500 Internal Server Error. Link to comment Share on other sites More sharing options...
kongondo Posted December 5, 2020 Share Posted December 5, 2020 (edited) Basically, you are doing something like this: <?php namespace ProcessWire; $someVariable->isLoggedin(); // BUT the value of $someVariable is a string, e.g. "some_string" // IT NEEDS to be an object of type User Hence, you get an error since a string cannot have properties or methods (functions). It would have been better to see your code ( your custom login/register system. ) but even without that, what you need to do is to check if $someVariable is an object of type User before calling isLoggedin() on it. Edited December 5, 2020 by kongondo clarification 2 1 Link to comment Share on other sites More sharing options...
modifiedcontent Posted December 6, 2020 Author Share Posted December 6, 2020 Thanks @kongondo . I redefined the $user variable in my login script, causing the error further down. Dumb mistake, easily fixed by changing to $username or something like that. Link to comment Share on other sites More sharing options...
kongondo Posted December 6, 2020 Share Posted December 6, 2020 17 minutes ago, modifiedcontent said: I redefined the $user variable in my login script, causing the error further down. Dumb mistake, easily fixed by changing to $username or something like that. Glad you resolved it! ?. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now