Has the way to determine if a user is logged in changed in 5.7/5.8?

Permalink
Hi There,

I'm starting to migrate a 5.6 theme over to 5.8 but see an error: 'Call to a member function isLoggedIn() on null'.

The theme's footer.php checks if someone is logged in like this.
global $u;
if ($u->isLoggedIn()) {
    // do something
}

After searching, it doesn't look anything has changed in 5.8. Is there something that needs loading maybe?

Any help or pointers in the right direction would be much appreciated.

Cheers

Ben

 
hutman replied on at Permalink Best Answer Reply
hutman
I've always done

$u = new User();

Rather than the global.
cmscss replied on at Permalink Reply
Awesome, worked a treat, thanks heaps.

This website stores cookies on your computer. These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media. To find out more about the cookies we use, see our Privacy Policy.