Hi everyone,
I was wondering if anyone could help me. I’ve recently upgraded my site from 2.0.8 to 2.1.3 (traditional on a server running PHP Version 5.2.17), and now on everypage I get the error:
Fatal error: Call to undefined method modX::userLoggedIn() in /nfs/c08/h04/mnt/125618/domains/omgconsult.com/html/core/cache/includes/elements/modsnippet/45.include.cache.php on line 8
I’ve deleted the contents of the core/cache folder (so I don’t have any logs to show :| ), and I’ve updated the login package via the package manager. I’ve also done the usual stuff such as clearing user sessions.
If anyone has any suggestions of what I could try next then that would be really appreciated.
Thanks,
- Ross
Run setup in upgrade mode if you haven’t already.
Clear your browser cache and cookies.
Use PhpMyAdmin to check the modx_workspaces table and make sure the path there is correct.
If none of those solves the problem, it sounds like either one or more files failed to replace those from the earlier version or one or more files was corrupted or missing in the file transfer.
Thanks BobRay, I’ll give each of these steps a shot tonight when I get home.
None of the above steps had any luck. Does anyone has any other suggestions?
Thanks,
- Ross
I don’t know if this helps, but if I comment out $modx->userLoggedIn() in all my snippets then my pages load correctly. Has this changed in 2.1.3? Does anyone know if there is a better way to check if a user is logged in?
Quote from: rossgledhill at Aug 16, 2011, 02:17 PM
I don’t know if this helps, but if I comment out $modx->userLoggedIn() in all my snippets then my pages load correctly. Has this changed in 2.1.3? Does anyone know if there is a better way to check if a user is logged in?
It helps a lot.
That function was deprecated a long time ago and was removed a couple of versions ago.
Try replacing $modx->userLoggedIn() with:
$modx->user->hasSessionContext($modx->context->get('key'))
If the snippet only operate in the front end and you only have the ’web’ context, you can use:
$modx->user->hasSessionContext('web');
Quote from: rossgledhill at Aug 19, 2011, 11:28 AM
Thanks! That worked a treat! 
Glad to hear it. Would you edit the subject to add [SOLVED] at the front.