Problem with isLoggedIn() and version preview
Permalinkcall to a member function isLoggedIn() on a non-object...

global $u; $u = new User(); if ($u -> isLoggedIn()) {
$u = new User(); if ($u -> isLoggedIn()) {
$u = new User();
That will just grab the current logged in user from the session. It won't even make a database query so there's really very little overhead.
the global $u isn't always a valid user object.