We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 35871
    • 6 Posts
    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
      • 3749
      • 24,544 Posts
      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.

        Did I help you? Buy me a beer
        Get my Book: MODX:The Official Guide
        MODX info for everyone: http://bobsguides.com/modx.html
        My MODX Extras
        Bob's Guides is now hosted at A2 MODX Hosting
        • 35871
        • 6 Posts
        Thanks BobRay, I’ll give each of these steps a shot tonight when I get home.
          • 35871
          • 6 Posts
          None of the above steps had any luck. Does anyone has any other suggestions?

          Thanks,

          - Ross
            • 35871
            • 6 Posts
            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?
              • 3749
              • 24,544 Posts
              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. smiley

              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');
                Did I help you? Buy me a beer
                Get my Book: MODX:The Official Guide
                MODX info for everyone: http://bobsguides.com/modx.html
                My MODX Extras
                Bob's Guides is now hosted at A2 MODX Hosting
                • 35871
                • 6 Posts
                Thanks! That worked a treat! smiley
                  • 3749
                  • 24,544 Posts
                  Quote from: rossgledhill at Aug 19, 2011, 11:28 AM

                  Thanks! That worked a treat! smiley
                  Glad to hear it. Would you edit the subject to add [SOLVED] at the front.
                    Did I help you? Buy me a beer
                    Get my Book: MODX:The Official Guide
                    MODX info for everyone: http://bobsguides.com/modx.html
                    My MODX Extras
                    Bob's Guides is now hosted at A2 MODX Hosting