We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 28042 ☆ A M B ☆
    • 24,524 Posts
    If you enable having manager users see unpublished documents in the front end, you can work with the idea of having the document unpublished. Use a snippet to scan the SESSION to see if the user is a logged-in manager user and create a link to the unpublished page if he is.
      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
      • 29703
      • 217 Posts
      Quote from: sottwell at Jan 03, 2008, 09:46 AM

      If you enable having manager users see unpublished documents in the front end, you can work with the idea of having the document unpublished. Use a snippet to scan the SESSION to see if the user is a logged-in manager user and create a link to the unpublished page if he is.

      Ah. Is there a snippet that achieves this already by any chance? I am not a developer you see, merely a designer.

      Thanks for your help by the way wink
        • 28042 ☆ A M B ☆
        • 24,524 Posts
        Not that I know of. There are a couple that check for web users, but not for manager users.

        Here is a variation on MemberCheck, ManagerCheck. See it in action http://www.sottwell.com/manager-check.html

        Copy the text from this file to a new snippet named ManagerCheck. Create a chunk with the link to the unpublished page you want the manager user to have access to. Make the snippet call wherever you want the link to show (you can add HTML to the chunk if you want, so you can style it) and change the parameters to match the name of the manager group and the chunk.

        Oops... nasty bug here. Line 117 needs to return false if manager is not logged in at all... attached file now fixed.
                    } else { return false; }
        
          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
          • 29703
          • 217 Posts
          Thanks Susan, that’s awesome!

          However it would be even more awesome if I could get it to work.

          Anyway, I can’t get it to work and this is what I have:

          Snippet call:

          [!ManagerCheck? &chunk=`NewsLink` &groups=`admins`!]


          Chunk:

          [(base_url)]index.php?id=51


          The snippet just doesn’t seem to be being called. . . Nothing appears on the page generated. I looked at the source and it’s just blank.

          P.s. Would it also make sense to have the URL as a parameter, to save creating a new chunk for every link?
            • 27708 MODX Staff
            • 2,502 Posts
            If I get what you are saying, you want to have:

            • a page for Admins to go to and edit/add pages on the front end
            • with the Rich Text Editor available

            I have done this with using the following combination:

            Modifying the Logout/Manager Links snippet is very easy to turn it into a login or you could use Manager Links (which it is based on).

            The reason I don’t used NewsPublisher anymore is that it is designed to use with WebUsers and it is a pain. By default the FDM is available to Admins only (you can extend it to groups and users as needed).

            Hope this helps (may make more work though).

            Jay
              Author of zero books. Formerly of many strange things. Pairs well with meats. Conversations are magical experiences. He's dangerous around code but a markup magician. Blog ✦ Twitter ✦ LinkedIn ✦ GitHub
              • 29703
              • 217 Posts
              Quote from: smashingred at Jan 04, 2008, 07:11 AM

              If I get what you are saying, you want to have:

              • a page for Admins to go to and edit/add pages on the front end
              • with the Rich Text Editor available

              I have done this with using the following combination:

              Modifying the Logout/Manager Links snippet is very easy to turn it into a login or you could use Manager Links (which it is based on).

              The reason I don’t used NewsPublisher anymore is that it is designed to use with WebUsers and it is a pain. By default the FDM is available to Admins only (you can extend it to groups and users as needed).

              Hope this helps (may make more work though).

              Jay

              I don’t need the admin to be able to add/edit pages, other than what is available with NewsPublisher - though I do need them to be able to use QuickEdit.

              I’ve basically hacked QuickEdit so the main toolbar doesn’t show up and have used TV’s for the content areas, so when the manager logs in there is a nice little edit button next to every section of content. This way, the client need never know that the manager even exists.

              Your combo looks a bit lengthy for what I’m trying to achieve. I have managed to hide the link with a CSS workaround, but when someone enters the URL (from looking in the source or whatever) for the news updating page, it’s accessible to the public.

              Security isn’t a huge issue with this site, though this is too much of a hole to ignore.


              I just need a page to be only accessible when the manager is logged in. I’m sure if I had a flair for PHP I’d soon find a workaround, but unfortunately my flair lies disregarded elsewhere.

              The ManagerCheck looks like it’d work, but I can’t get it to work. Arg.
                • 27708 MODX Staff
                • 2,502 Posts
                Quote from: thehen at Jan 04, 2008, 07:23 AM

                I don’t need the admin to be able to add/edit pages, other than what is available with NewsPublisher - though I do need them to be able to use QuickEdit.

                I’ve basically hacked QuickEdit so the main toolbar doesn’t show up and have used TV’s for the content areas, so when the manager logs in there is a nice little edit button next to every section of content. This way, the client need never know that the manager even exists.

                Your combo looks a bit lengthy for what I’m trying to achieve. I have managed to hide the link with a CSS workaround, but when someone enters the URL (from looking in the source or whatever) for the news updating page, it’s accessible to the public.

                Security isn’t a huge issue with this site, though this is too much of a hole to ignore.

                I just need a page to be only accessible when the manager is logged in.

                Ahh, I think I get what you are doing now. My solution may be overkill for the time permitted but it is actually what I would do and have done in the same case. (I don’t use quickedit though as I like the front end forms of FDM better for clients. JS popups can confuse some of my clients so I try to avoid them as much as necessary (although Tiny MCE uses them)

                If you have an admin user with the proper permissions they will be able to access pages even if they are unpublished. So if the only person going to the NewsPublisher page is an admin then you should be able to unpublish it. Just use the [~5~] where 5 is the id of your newspublisher publish page.

                If I am not mistaken the Manager Login only works with its sibling snippet so it may not do what you want it to do.

                On your link, I am not sure if it is correct or not. I would try the following [~51~] but I’d have to check the params to see how the manager login worked again. Try placing a full URL in your "NewsLink" chunk: <a href="[~51~]">Edit</a> to generate the link when the manager is logged in.
                  Author of zero books. Formerly of many strange things. Pairs well with meats. Conversations are magical experiences. He's dangerous around code but a markup magician. Blog ✦ Twitter ✦ LinkedIn ✦ GitHub
                  • 29703
                  • 217 Posts
                  Quote from: smashingred at Jan 04, 2008, 08:38 AM

                  Quote from: thehen at Jan 04, 2008, 07:23 AM

                  I don’t need the admin to be able to add/edit pages, other than what is available with NewsPublisher - though I do need them to be able to use QuickEdit.

                  I’ve basically hacked QuickEdit so the main toolbar doesn’t show up and have used TV’s for the content areas, so when the manager logs in there is a nice little edit button next to every section of content. This way, the client need never know that the manager even exists.

                  Your combo looks a bit lengthy for what I’m trying to achieve. I have managed to hide the link with a CSS workaround, but when someone enters the URL (from looking in the source or whatever) for the news updating page, it’s accessible to the public.

                  Security isn’t a huge issue with this site, though this is too much of a hole to ignore.

                  I just need a page to be only accessible when the manager is logged in.

                  Ahh, I think I get what you are doing now. My solution may be overkill for the time permitted but it is actually what I would do and have done in the same case. (I don’t use quickedit though as I like the front end forms of FDM better for clients. JS popups can confuse some of my clients so I try to avoid them as much as necessary (although Tiny MCE uses them)

                  If you have an admin user with the proper permissions they will be able to access pages even if they are unpublished. So if the only person going to the NewsPublisher page is an admin then you should be able to unpublish it. Just use the [~5~] where 5 is the id of your newspublisher publish page.

                  If I am not mistaken the Manager Login only works with its sibling snippet so it may not do what you want it to do.

                  On your link, I am not sure if it is correct or not. I would try the following [~51~] but I’d have to check the params to see how the manager login worked again. Try placing a full URL in your "NewsLink" chunk: <a href="[~51~]">Edit</a> to generate the link when the manager is logged in.


                  I don’t believe it - you’ve answered my question and it was infinitely easier than I had anticipated.

                  Basically I needed to unpublish the page. I didn’t realise managers could view unpublished pages from the front end without additional snippet support.

                  Also I wasn’t aware of the [~ID~]. This has helped me out tremendously.

                  I’m not sure what you mean in regards to ManagerLogin as it seems to work fine for me.

                  Thanks everyone, for your unwavering support. It is appreciated beyond your wildest fantasies.
                    • 27708 MODX Staff
                    • 2,502 Posts
                    Glad to help. Sometimes it takes my longwinded rambling to figure out what another person is trying to accomplish. Glad it is working.

                    Using [~51~] is infinately faster than typing [(base_url)]index?id=51 the MODx parser runs so let it parse smiley

                    All the best to your project.

                    Cheers,

                    Jay
                      Author of zero books. Formerly of many strange things. Pairs well with meats. Conversations are magical experiences. He's dangerous around code but a markup magician. Blog ✦ Twitter ✦ LinkedIn ✦ GitHub