We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 18463
    • 121 Posts
    Martijn van Turnhout Reply #11, 15 years, 5 months ago
    Aren’t you guys looking in the wrong directions? I think you’re better off using the "filter" option (Analytics > profile settings > filters) for this.
      • 12028
      • 152 Posts
      @Martijn: You are right, it could be a solution, but I travel a lot and therefore I haven’t a static IP...
      But thanks for your suggestion!
        - A small step for mankind, so why not take two...

        Working with web production, graphic design/workflow, photo and education - but are trying to get a life in between!
        • 3749
        • 24,544 Posts
        This version should work in all contexts if you’re previewing from the Manager (though I haven’t tested it):
        <?php
        return $modx->user->isMember('Administrator') ?  'You are logged in.'  :  $modx->getChunk('GAnalytics') ;
          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
          • 12028
          • 152 Posts
          Thanks BobRay - again!

          Still no luck - but I think it’s a session cookie problem. The web/mgr context are on the same domain.tld, and the rest of the contexts are on separate domains.tld. The solution must be to write a plugin there stores the session cookies on the other contexts/domains when a admin are logged into the manager.

          But thanks for your help - seeing forward to your book about Revo!
            - A small step for mankind, so why not take two...

            Working with web production, graphic design/workflow, photo and education - but are trying to get a life in between!
            • 3749
            • 24,544 Posts
            Just out of curiosity, if you put this on a page in another context, what does it show when previewing it from the Manager?

            <p>Current Username: [[*username]]</p>


              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
              • 12028
              • 152 Posts
              With
              [[*username]]
              nothing.

              But with:
              [[+modx.user.username]]
              I got my username correct in the web context, and in the rest of them: anonymous
                - A small step for mankind, so why not take two...

                Working with web production, graphic design/workflow, photo and education - but are trying to get a life in between!
                • 3749
                • 24,544 Posts
                Right, [[*username]] would be useless -- don’t know what I was thinking there. tongue

                As you suggested, it looks like you need to explicitly log in in the other contexts although I don’t see why that should be the case.
                  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