Jump to content

[SOLVED] What does this mean - Uncaught Error: Call to a member function isLoggedin() ?


Recommended Posts

Posted

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. 

Posted (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 by kongondo
clarification
  • Like 2
  • Thanks 1
Posted
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! ?.

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...