We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 7327
    • 195 Posts
    Hi,

    I've two MODX installations running on a main domain name (2.2.5PL) and one that's on an addon domain name (2.2.6PL), same webhosting. I'm using Mark Hamstra's code to detect a user is logged into the manager from the front end. The one I installed on the my site works fine. The one on the addon domain doesn't. Same code. I was trying to debug and see what user was being detected in the front end (while I'm logged into the manager). Echoing $modx->context->key returns "web", and the user as anonymous. Is this a bug? Any other methods of detection I can try?
      • 7327
      • 195 Posts
      Bump.

      Anyone?

      This essentially means no manager detection in my case... Really odd problem here..

      • Try putting in a debugging snippet that will output the entire SESSION with code something like this:
        <?php
        echo "</pre>";
        print_r($_SESSION);
        echo "</pre>";
        return;
          Studying MODX in the desert - http://sottwell.com
          Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
          Join the Slack Community - http://modx.org
          • 7327
          • 195 Posts
          Hmm.. blank.. as in nothing in between the pre tags..
            • 7327
            • 195 Posts
            Ah Sh*t! There we go.

            I'm not sure yet what exactly it's about, but it involved the php.ini file I had there. I re-set my Cpanel's PHP Config to use a "PHP 5.2 (single.php)" again (I set it to this before but the radio button's back to the default "PHP 5.2" setting. Anyway, I set the following first before uploading:

            session.auto_start = 1

            And the array's filled up as it should be.

            Thanks for the tip Susan wink
              • 7327
              • 195 Posts
              Well, that solved my other problem - hiding analytic tags for manager users. The other thing that's still baffling me is why I can't seem to view unpublished resources (frontend preview) as a manager... It always throws me to my homepage.
              • As far as I know, you can't use session.auto-start with MODx, because MODx starts its own session on every page request. If you are using a default PHP session, then you won't get the MODx stuff. Also, MODx stores sessions in the database instead of using the default PHP filesystem storage.
                  Studying MODX in the desert - http://sottwell.com
                  Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
                  Join the Slack Community - http://modx.org
                • Are your manager and website on different (sub)domains, perhaps? Sounds like it may not be sharing the session cookie.
                    Mark Hamstra • Developer spending his days working on Premium Extras and a MODX Site Dashboard with the ability to remotely upgrade MODX and extras to make the MODX world a little better.

                    Tweet me @mark_hamstra, check my infrequent blog at markhamstra.com, my slightly more frequent ramblings at MODX.today or see code at Github.
                    • 7327
                    • 195 Posts
                    They're both on the same domain. I'm using an addon domain if that matters (Didn't have an issue like this with regular domain and webhosting setup.)
                    • sub.domain.com does not count as the same as domain.com or www.domain.com as far as sessions go.
                        Studying MODX in the desert - http://sottwell.com
                        Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
                        Join the Slack Community - http://modx.org