We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 23491 ☆ A M B ☆
    • 1,056 Posts
    I use PHx all of the time w/ [~[*id*]~], and it plays quite nicely. I think the main problem that will arise is that placeholders are created on-the-fly (during snippet run time), but any placeholders would have already been wiped away by the PHx parser, as they did not exist yet.

    However, this should only be an issue for placeholders within the template/content areas directly. If a chunk/snippet combo is used where getChunk retrieves the template containing the placeholder references (which I believe WLPE mainly does), then it actually might be OK...It is good to understand potential conflicts.

    In fact, I have tested very high-level w/ PHx enabled and haven’t seen anything unexpected as I am only using the snippet call, and no placeholders outside of WLPE chunks. When I do place a UserPlaceholder inside of a content area, or normally parsed {{chunk}}, nothing is output for the PH

    e.g.

    My username is :[+user.username+]

    To work around this, you have to place in a chunk, and use $modx->getChunk() (when PHx is enabled)

    Also, in docs/parameters.html and docs/forms.html, there area some references to &cutomFields which I believe should be &customFields


    On a separate note: What if you didn’t want to offer the "Delete" profile functionality? I assume leveraging a custom template and removing the "service=deleteprofile" button would be the first step, but what if someone happened to know about the functionality and manually passed in "?service=deleteprofile" ...By using WLPE, does this automatically give users this ability, regardless?
      Mike Reid - www.pixelchutes.com
      MODx Ambassador / Contributor
      [Module] MultiMedia Manager / [Module] SiteSearch / [Snippet] DocPassword / [Plugin] EditArea / We support FoxyCart
      ________________________________
      Where every pixel matters.
      • 26435
      • 1,193 Posts
      ScottyDelicious Reply #142, 19 years ago
      Quote from: pixelchutes at Sep 04, 2007, 10:13 AM
      On a separate note: This is not very likely to happen, but what if you didn’t want to offer the "Delete" profile functionality? Well, I assume leveraging a custom template and removing the "service=deleteprofile" button would be the first step, but what if someone happened to know about the functionality and manually passed in "?service=deleteprofile" ...By having WLPE installed, does this automatically give users this ability, regardless?
      Good point.
      I should probably change all the "profile" services to switch on $_POST[’service’] instead of $_REQUEST[’service’], then maybe specify that $_GET[’service’] = NULL; so that stuff could not be passed in the url.

      Damn... my spell check must be worn out tongue

      -sD-
      Dr. Scotty Delicious, Scientist DFPA.
        Husband, Father, Brother, Son, Programmer, Atheist, Nurse, Friend, Lover, Fighter.
        All of the above... in no specific order.


        I send pointless little messages
        • 23491 ☆ A M B ☆
        • 1,056 Posts
        Quote from: Dr. at Sep 04, 2007, 10:28 AM

        Good point.
        I should probably change all the "profile" services to switch on $_POST[’service’] instead of $_REQUEST[’service’], then maybe specify that $_GET[’service’] = NULL; so that stuff could not be passed in the url.

        I like your direction. Unfortunately, the approach wouldn’t be 100% preventable. A crafty user could easily create a simple <form> block, passing ’deleteprofile’ via the service parameter and would still technically be able to delete their own profile...don’t get me wrong, I may be taking this too far, but I can see some sites where "profile deletion" would NOT be desired by any means.

        Maybe you could create an "enable_xxxx" (e.g. enable_deleteprofile) parameter, and setting it to 0 (zero) would protect profile deletion in cases such as those...

        Or, disableDeleteProfile, so toggling "Off" is based on WLPE’s default behavior where deleting is enabled.

        e.g.
        [!WebLoginPE? &disableDeleteProfile=`1`!]
        
          Mike Reid - www.pixelchutes.com
          MODx Ambassador / Contributor
          [Module] MultiMedia Manager / [Module] SiteSearch / [Snippet] DocPassword / [Plugin] EditArea / We support FoxyCart
          ________________________________
          Where every pixel matters.
          • 23491 ☆ A M B ☆
          • 1,056 Posts
          I tried passing a custom profileTpl chunk that ONLY allows for password/email updates by the user:

          Only when I try changing either the password or the email address, nothing happens sad


          <div id="wlpeUser">
          <form enctype="multipart/form-data" id="wlpeUserProfileForm" action="[~[*id*]~]" method="POST">
          <fieldset id="wlpeUserProfileInput">
          <div id="wlpeUserInfo">
          <h3 id="wlpeProfileWelcome">Hello [+user.fullname+] ([+user.username+])!</h3>
          <p id="wlpeProfileInfo" class="info">Use this form to update your profile information</p>
          </div>

          <legend>Your User Profile</legend>

          <label for="wlpeUserProfileEmail">Email
          <input id="wlpeUserProfileEmail" type="text" name="email" value="[+user.email+]" />
          </label>

          <fieldset id="wlpeNewPasswordArea">
          <legend id="wlpeNewPasswordAreaLegend">Change your password</legend>
          <p id="wlpeNewPasswordInfo">Change your password
          <span class="info">(leave blank if you do not want a new password).</span></p>

          <label for="wlpeUserProfilePassword">New Password
          <input id="wlpeUserProfilePassword" type="password" name="password" value="" />
          </label>

          <label for="wlpeUserProfilePasswordConfirm">New Password (confirm)
          <input id="wlpeUserProfilePasswordConfirm" type="password" name="password.confirm" value="" />
          </label>
          </fieldset>

          </fieldset>
          <fieldset id="wlpeUserProfileButtons">
          <button type="submit" id="wlpeSaveProfileButton" name="service" value="saveprofile">Save</button>
          <button type="submit" id="wlpeProfileDoneButton" name="service" value="cancel">Done</button>
          <button type="submit" id="wlpeProfileLogoutButton" name="service" value="logout">Logout</button>
          </fieldset>
          </form>
          </div>

          Also, [+wlpe.message+] is included in the default profileTpl, but not in the example shown in: assets/snippets/webloginpe/Default Forms/defaultProfileTpl.html.txt

          I was confused as to why I wasn’t seeing the update message after any of my actions...
            Mike Reid - www.pixelchutes.com
            MODx Ambassador / Contributor
            [Module] MultiMedia Manager / [Module] SiteSearch / [Snippet] DocPassword / [Plugin] EditArea / We support FoxyCart
            ________________________________
            Where every pixel matters.
            • 26435
            • 1,193 Posts
            ScottyDelicious Reply #145, 19 years ago
            Quote from: pixelchutes at Sep 04, 2007, 11:19 AM

            I tried passing a custom profileTpl chunk that ONLY allows for password/email updates by the user:

            Only when I try changing either the password or the email address, nothing happens sad

            Also, [+wlpe.message+] is included in the default profileTpl, but not in the example shown in: assets/snippets/webloginpe/Default Forms/defaultProfileTpl.html.txt

            I was confused as to why I wasn’t seeing the update message after any of my actions...
            Oops, putting the messages in a placeholder was a last minute change. I forgot to update the example forms.
            That is very interesting that your custom template will not save? I am not sure why that is. I am using a custom profile template on the demo site and it seems to work fine.

            2 questions...
            Where did you put the [+wlpe.message+] placeholder and what is the caching status on that profile page.

            -sD-
            Dr. Scotty Delicious, Scientist DFPA.
              Husband, Father, Brother, Son, Programmer, Atheist, Nurse, Friend, Lover, Fighter.
              All of the above... in no specific order.


              I send pointless little messages
              • 26435
              • 1,193 Posts
              ScottyDelicious Reply #146, 19 years ago
              oh, one more thing. if you copy the default profile template verbatim to a chunk (plus the placeholder that I forgot about wink), does it save as expected? Maybe see what has to be taken away before it stops working?

              -sD-
              Dr. Scotty Delicious, Scientist DFPA.
                Husband, Father, Brother, Son, Programmer, Atheist, Nurse, Friend, Lover, Fighter.
                All of the above... in no specific order.


                I send pointless little messages
                • 23491 ☆ A M B ☆
                • 1,056 Posts
                1. The reason I didn’t see the message (at first) was because I copy/pasted from the example template. Therefore, I did not have the placeholder present at all. Once added, all was well! Yes, saving worked as expected when copying verbatim....

                2. Caching disabled, snippet call [!uncached!]
                  Mike Reid - www.pixelchutes.com
                  MODx Ambassador / Contributor
                  [Module] MultiMedia Manager / [Module] SiteSearch / [Snippet] DocPassword / [Plugin] EditArea / We support FoxyCart
                  ________________________________
                  Where every pixel matters.
                  • 23491 ☆ A M B ☆
                  • 1,056 Posts
                  Aahh...but I am not passing photo


                  I could not upload your photo. Please check the permissions of the "userimages" folder.
                    Mike Reid - www.pixelchutes.com
                    MODx Ambassador / Contributor
                    [Module] MultiMedia Manager / [Module] SiteSearch / [Snippet] DocPassword / [Plugin] EditArea / We support FoxyCart
                    ________________________________
                    Where every pixel matters.
                    • 26435
                    • 1,193 Posts
                    ScottyDelicious Reply #149, 19 years ago
                    Quote from: pixelchutes at Sep 04, 2007, 10:35 AM

                    Quote from: Dr. at Sep 04, 2007, 10:28 AM

                    Good point.
                    I should probably change all the "profile" services to switch on $_POST[’service’] instead of $_REQUEST[’service’], then maybe specify that $_GET[’service’] = NULL; so that stuff could not be passed in the url.

                    I like your direction. Unfortunately, the approach wouldn’t be 100% preventable. A crafty user could easily create a simple <form> block, passing ’deleteprofile’ via the service parameter and would still technically be able to delete their own profile...don’t get me wrong, I may be taking this too far, but I can see some sites where "profile deletion" would NOT be desired by any means.

                    Maybe you could create an "enable_xxxx" (e.g. enable_deleteprofile) parameter, and setting it to 0 (zero) would protect profile deletion in cases such as those...

                    Or, disableDeleteProfile, so toggling "Off" is based on WLPE’s default behavior where deleting is enabled.

                    e.g.
                    [!WebLoginPE? &disableDeleteProfile=`1`!]
                    

                    A crafty user, as you say, could also pass the url http://yoursite.url/profile.html?disableDeleteProfile=1&service=deleteprofile.
                    I think spending too much time trying to foil the plans of potential "super-villain" users is going to slow progress at this point. I think taking it out of the realm of GET should be a good level of defense. Any thing more is going to require a smart, determined hacker to get through, and you are not going to stop them anyway, right? tongue

                    -sD-
                    Dr. Scotty Delicious, Scientist DFPA.
                      Husband, Father, Brother, Son, Programmer, Atheist, Nurse, Friend, Lover, Fighter.
                      All of the above... in no specific order.


                      I send pointless little messages
                      • 23491 ☆ A M B ☆
                      • 1,056 Posts
                      Quote from: Dr. at Sep 04, 2007, 11:50 AM

                      A crafty user, as you say, could also pass the url http://yoursite.url/profile.html?disableDeleteProfile=1&service=deleteprofile

                      @sD,

                      Actually, this is incorrect. In the example, disableDeleteProfile would be a SNIPPET parameter only. Such parameters cannot be altered/hi-jacked, regardless of GET/POST request unless the snippet author somehow allows them to be overwritten. Really, it’d be a PHP boolean declared at run time.


                      As for my previous post, it turns out if I do add the "photo" portions of the profile, I no longer receive the error and am able to update my email/password only. The error checking is working, but should it only happen when the field exists?

                        Mike Reid - www.pixelchutes.com
                        MODx Ambassador / Contributor
                        [Module] MultiMedia Manager / [Module] SiteSearch / [Snippet] DocPassword / [Plugin] EditArea / We support FoxyCart
                        ________________________________
                        Where every pixel matters.