We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 4295
    • 98 Posts
    I love this snippet but noticed a strange thing. I can login and go to my "edit my profile" page and edit my profile fine but when I logout, I get the error message below. The same thing happens when I login, go to the "edit my profile" page and logout WITHOUT editing my profile. BUT if I login and go to the "edit my profile" page (whether or not I actually edit my profile) AND THEN go to another page to logout, everything is fine. Anyone know why this is happening?
    MODx encountered the following error while attempting to parse the requested resource:
    « Execution of a query to the database failed - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1 »
          SQL: SELECT * FROM `blahblah_modx`.modx_web_user_attributes WHERE internalKey = ; 




      • 31037
      • 358 Posts
      Bullat, the problem occurs when MODx tries to display the edit page *after* logout. If the user is still on the edit page when logging off, he/she must be directed to another page, otherwise this error occurs.

      Think some kind of fix is needed in the snippet.
        • 4295
        • 98 Posts
        Uncle68, thanks for the explanation. I’ll try to figure out how to redirect back to previous page to prevent the error. Thanks again. Much appreciated.
          • 31037
          • 358 Posts
          Let me know how you solve it. I’m looking into this snippet right at this moment, to try to learn something smiley

          I guess a simple check to see if the user is logged in, and taking the apropiate actions if not, would solve it.

          But I’m a newbie, so I wouldn’t count on it wink
          • Why isn’t the profile editing page assigned to a document group that is associated with the web group a user accessing their profile for editing would belong to? Then on logout the user would automatically be sent to the "unauthorized" page, usually the home page. And/or the weblogin snippet should have a "logouthomeid" value set so the user is automatically sent to that page on logout. A non-logged in user should not be able to access the profile editing page at all.
              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
              • 4295
              • 98 Posts
              Susan: Thanks so much for your clear and detailed reply. Although I have my "Edit your Profile" link hidden until a user has logged in, I hadn’t yet set up a document group for registered users! So I did that and added the &logouthomeid parameter and I’m all set and works fine. You have no idea how useful an answer like yours is to all we noobs. Thanks again.

              Uncle68: In the slim chance that you don’t know this...
              1) Went to Manager > Security > Web Permissions and created a Document Group for registered user pages. I attached that to my Registered User Group.
              2) Edited my "Edit your Profile" page (under Access Permissions at the very bottom of the page) to check the box next to my new document group.
              3) Added the parameter &logouthomeid=`1` to my WebLogin snippet call in my template.
              4) Then let out a Woot! because it works fine now.
              • However, it is a bug in the WebEditProfile snippet not to check for that and redirect somewhere, by default to the home page but with an option to specify where to send a non-logged-in user if he does somehow end up on the page. I’ll have to do something about it.
                  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
                • Updated: Version 1.3 - added redirect for non-logged-in users. For this redirect to work, the page the snippet is called in must be uncached.

                  The profile editing page should still be protected by a document group that only logged-in users have access to.

                  http://modxcms.com/Web-Edit-Profile-Snippet-1.0-990.html
                    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
                    • 31037
                    • 358 Posts
                    Quote from: bullrat at Oct 29, 2006, 02:32 AM
                    Uncle68: In the slim chance that you don’t know this...
                    I did know that, but I think it’s great that you explain, lots of people are reading this!

                    I actually don’t use this excellent snippet, I’m trying to build my own customized snippet by looking into the code. A great way learning the inner pieces of MODx. smiley

                    Good luck!
                      • 4295
                      • 98 Posts
                      Susan, could you post the old v1.2 snippet here or add it to the "previous versions" in the repository? I was too eager and didn’t save a copy when upgrading to v1.3. I know, mortal sin. v1.3 doesn’t work properly for my circumstances and I need to go back to the v1.2. I have a tiny login box (called in template to display on every page) and the user doesn’t see the "Edit your Profile" until logged in. It didn’t matter with v1.2 whether a page was cached or not and worked fine. Could someone post the v1.2 here or in repository? Thanks.

                      EDIT: Okay, I did save a copy, thank goodness. But you might consider adding the old version to the "previous versions" in the repository. Thanks for a great snippet, Susan.