We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 18397
    • 3,250 Posts
    I am attempting to add an Edit button to the bottom of every page if the user is logged into the manager. For example, user logs into manager either via the MemberMakeMenu interface (MemberLogin) or the manager itself. Then when the user goes to view a page he can easily click edit and instantly edit the page without finding it in the document tree (saves a few clicks).I am using a modded MemberMakeMenu snippet suite.
    (The only change I made was altering the logged in output to
     $thispageid = $etomite->documentIdentifier; 
       $output.="<a href='index.php?a=27&id=".$thispageid."'>Edit</a>\n";
    

    otherwise it is a stock install)

    Please advise. Are there any issues with MODx and these snippets. I am running TP3.
      • 32963
      • 1,732 Posts
      What doe MemberMakeMenu do? Does it uses it’s own user validation system?
        xWisdom
        www.xwisdomhtml.com
        The fear of the Lord is the beginning of wisdom:
        MODx Co-Founder - Create and do more with less.
        • 18397
        • 3,250 Posts
        It is used to allow a user to login to the manager without going to the manager login page.
          • 7455
          • 2,204 Posts
          The MemberMakeMenu is based on the the webuser snippet suite that was made for etomite
            follow me on twitter: @dimmy01
            • 18397
            • 3,250 Posts
            In other words, is there another way to determine if a manager user is logged in or not in Modx? This way I could say if the user is logged in to the manager then display edit button. If the user is not logged in, display a login box.
              • 8634
              • 56 Posts
              As this is a much sought after solution, would you please be so kind to share this with us when successfully working. My authorised users would love to be able to straight "link" to edit their pages from the website.
                • 18397
                • 3,250 Posts
                Quote from: eko40 at Jul 24, 2005, 07:08 AM

                As this is a much sought after solution, would you please be so kind to share this with us when successfully working. My authorised users would love to be able to straight "link" to edit their pages from the website.

                Sure. I would be glad to. I just need to know how to determine if a user is authenticated or not though (see above post). Otherwise the edit link is already done. You just insert a link using a snippet to the manager url using the following code (not a complete snippet);

                 $thispageid = $etomite->documentIdentifier; 
                   $output.="<a href='index.php?a=27&id=".$thispageid."'>Edit</a>\n";
                
                ]

                I just have to figure out to make it so that only people logged in to the manager can see this.
                • It’s in the SESSION array. If you put this somewhere, like at the beginning of a snippet, you can check what it has.

                  echo "<pre>";
                  print_r($_SESSION);
                  echo "</pre>";
                  


                  Logging in from the front-end is easy; if the login doesn’t find the username in the web users table, just have it check the manager users table. Load the SESSION array appropriately. You’ll need to hack the weblogin include files to do that, though. Then make your edit snippet check for the SESSION[usertype] and make sure it’s manager to display the edit link/button whatever.
                    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
                    • 32963
                    • 1,732 Posts
                    For the time being you can use $_SESSIOn[’mgrValidate’] to test if user is logged into the manager
                      xWisdom
                      www.xwisdomhtml.com
                      The fear of the Lord is the beginning of wisdom:
                      MODx Co-Founder - Create and do more with less.
                      • 18397
                      • 3,250 Posts
                      $_SESSION[’mgrValidate’] does not seem to work.