We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 37383
    • 6 Posts
    On a live site (yes, I know, I should back-up and do this locally) I'd like to add a div that only I - or anyone else with high enough priveleges - can see when logged into the manager.

    All documentation I've come across seems to be concerned with admin pages, rather than areas within pages. Is this easily accomplished? [ed. note: chris. last edited this post 12 years, 6 months ago.]
      • 13218
      • 134 Posts
      Hi Chris,
      i should think you could use the user object for that:
      http://rtfm.modx.com/display/revolution20/modUser

      Something like
      if ($modx->user->isAuthenticated('web') && $modx->user->isMember('someGroup')) {
         /* return some Chunk */
      }
      [ed. note: itWillBeOk last edited this post 12 years, 6 months ago.]
        @itWilllBeOK
        • 3749
        • 24,544 Posts
        That would do it. A full version might look like this:
        [[ShowMyStuff]]


        <?php
        /* ShowMyStuff snippet */
        $output = "";
        if ($modx->user->isAuthenticated('web')
             && $modx->user->isMember('Administrator')
            && $modx->user->get('username') == 'MyUserName'
        ) {
          $output =  $modx->getChunk('SomeChunk');
        }
        
        return $output;



          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
          • 37383
          • 6 Posts
          Thanks to you both - I'll admit though, the first example had me a little perplexed.
          I appreciate the elaboration.
            • 13218
            • 134 Posts
            Well, Bob is the one who writes the books,.. btw, Bob, ye olde Germany is waiting for yours with blood shot eyes! Any day now...

              @itWilllBeOK