We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 28033
    • 925 Posts
    Not a issue with the code, but on your documentation, it’s loading a bare-bones version of your homepage for WLPE for the &notifyTpl section plain-text example (no CSS, basically), instead of the text. It works if you remove the .html in it, however.

    I dunno what’s making it do that, considering the other .txt.html ones work fine.
      My Snippets
      -> PopUpChunk v1.0
      • 26435
      • 1,193 Posts
      ScottyDelicious Reply #52, 19 years ago
      Quote from: Soshite at Sep 29, 2007, 09:06 PM

      Not a issue with the code, but on your documentation, it’s loading a bare-bones version of your homepage for WLPE for the &notifyTpl section plain-text example (no CSS, basically), instead of the text. It works if you remove the .html in it, however.

      I dunno what’s making it do that, considering the other .txt.html ones work fine.
      There was an actual text file there at one time, but I deleted it (by accident) when I removed the entire webloginpe folder to upload 1.3.0 for testing. that is also why everyone’s pics got deleted.

      I will get the text files back up for informational purposes.

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


        I send pointless little messages
        • 22388
        • 100 Posts
        Quote from: Soshite at Sep 29, 2007, 06:59 PM
        Are you meaning that when an error pops up, it’ll show in both places (or anything else that deals with wlpe.message?...
        No. I meaning that if I use &dateFormat=’%A, %d-%m-%y’ in sidebar and &dateformat=’%d-%m-%y’ in userlist for example, then date is displayed in a format %d-%m-%y in both places! And the same situation with lang parameter.
          Sorry for my english! smiley
          • 23491 ☆ A M B ☆
          • 1,056 Posts
          WLPE Snippet Call:
          [!WebLoginPE? &type=`profile` &tableCheck=`0` &successTpl=`wlpe_profile_tpl` &profileTpl=`wlpe_profile_tpl`!]


          wlpe_profile_tpl Chunk:
          [+wlpe.message+]
          <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>
                      
                      
                      <input style="display:none" id="wlpeUserProfilePhoto" type="file" name="photo" value="" />
                    
                      <fieldset id="wlpeNewPasswordArea">
                          <legend id="wlpeNewPasswordAreaLegend">Change your password</legend>
                          <p id="wlpeNewPasswordInfo">Change your password <br /><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>
                  </fieldset>
              </form>
          </div>
          



          Bug # 1

          I wanted a simple "Change Email/Password" form on a site...

          BUG: Duplicate web user email potential via Profile Edit

          After a successful test of updating my email, I quickly found that I could update to ANY email address I wanted...regardless if it already existed for a previously defined user! Further, out of the box there did not seem to be any kind of data validation on the email field. I was able to enter the word: test and it was accepted as my new email address...

          Are WLPE users required to build out all validation rules?


          Bug # 2
          If I enter a BLANK value for the email field, I am thrown a database error:

          UPDATE `modx`.`modx_web_user_attributes` SET WHERE `internalkey` = ’123’

          It appears as if the SQL is run regardless of whether or not any fields are present to be updated...

          Solution # 2
          Find the following code in webloginpe.class.php:
          $saveMyProfile = $modx->db->query($generalElementsSQL);

          and replace it with:
          if( count($generalElementsUpdate) > 0 ) $saveMyProfile = $modx->db->query($generalElementsSQL);


          This will prevent the SQL from running if there is nothing to update.


          Bug # 3
          Also, the following System Events don’t seem to execute as one might expect:

          OnBeforeWebSaveUser
          OnWebChangePassword


          Although, this System Event seems to be running correctly:

          OnWebSaveUser


          Looking into the documentation, this is what I found:

          OnBeforeWebSaveUser
          Invoked BEFORE user attributes are saved to the DB. This is invoked in both Register() AND SaveUserProfile(). Parameters are ’Attributes’ and ’ExtendedFields’, so... all the users info.


          OnWebChangePassword
          Invoked AFTER a user changes their password. This is invoked in ActivateUser() (when a user forgot their password, gets it reset and sets a new one.), and in SaveUserProfile() IF the user’s password is changed. Parameters are ’internalKey’, ’username’, and ’password’ (the NEW password).

          However, reviewing the code I found that OnWebChangePassword is invoked ONLY in ActivateUser() (~Line #1696)
          and that OnBeforeWebSaveUser is invoked in SaveUserProfile() ONLY if $this->CustomFields is not blank, not to mention AFTER the OnWebChangePassword event...this should be "Invoked BEFORE user attributes are saved to the DB."

          Solution # 3a
          Invoke the method inside of SaveUserProfile() ...add code to approx Line #829
          // EVENT: OnWebChangePassword
          $this->OnWebChangePassword( $internalKey, $currentWebUser['username'], $_POST['password'] ); // pixelchutes
          


          Solution # 3b
          OnBeforeWebSaveUser solution coming soon...
          In the meantime, change the following code in the SaveUserProfile() function:

          From this:
          		if (!empty($_POST['password']) && isset($_POST['password']) && isset($_POST['passwordconfirm']))


          To this:
          		// EVENT: OnBeforeWebSaveUser
          		$this->OnBeforeWebSaveUser(array(), array()); // pixelchutes
          		if ( !empty($this->Report) ) return; // pixelchutes
          
          		if (!empty($_POST['password']) && isset($_POST['password']) && isset($_POST['password_confirm'])) // pixelchutes
          


          NOTE: This solution should be considered temporary. It simply enables the invocation of the OnBeforeWebSaveUser system event at the proper time. Note, invoked in the manner provided above, this function will send empty arrays as its arguments until the official solution is rolled out. In the meantime, you can access the generalElements and extendedFields via PHP’s $_REQUEST scope.




          Bug # 4
          NOTE: If you have already applied the solution #3b above, then a portion of Bug #4’s solution will already have been applied.

          In SaveUserProfile() the Confirm Password logic appears to be invalid:

          		if (!empty($_POST['password']) && isset($_POST['password']) && isset($_POST['passwordconfirm']))
          		{
          			if ($_POST['password'] === $_POST['passwordconfirm'])
          
          


          It should be looking for "password_confirm":
          Solution # 4
          		if (!empty($_POST['password']) && isset($_POST['password']) && isset($_POST['password_confirm'])) // pixelchutes
          		{
          			if ($_POST['password'] === $_POST['password_confirm']) // pixelchutes
          




          Bug # 5
          I have tracked down other "_confirm" issues, specifically Internet Explorer and "Reset Password" not working...this is because the default TPL for Activation outputs the password confirmation as: newpassword.confirm and in the Class PHP file, it references:
          $newPasswordConfirm = $modx->db->escape($_POST['newpasswordconfirm']);

          but should be:
          Solution # 5
          $newPasswordConfirm = $modx->db->escape($_POST['newpassword_confirm']);

          and don’t forget to update to newpassword_confirm in the form for your templates.

          Note to Scotty: Documentation/Templates should be globally updated to account for "_confirm" logic.


          Bug # 6
          Pressing "Enter" to submit your email on the "Forgot Password" form does not seem to work in Internet Explorer...it simply takes back to the main login page. Enter in FireFox works, and it works in IE if I click on the button.....this is related to the "ieButtonFix.js"

          Since the fix is applied via onclick events tied to the submit buttons, the fix does not get applied when a user submits the form via the Enter key.

          Solution # 6

          The solution here is to either
          A.) See if you can trigger the onclick event of the first <button> upon pressing Enter,
          B.) Disable "Enter" key form submission in IE

          * Please see attached file, updated ieButtonFix.js (remove .txt extension)
          The attached file has been tested/confirmed to work in IE 6 and 7, and should work with multiple Forms, too (as long as each WLPE form has a unique ID). This enables the ability for IE users to submit the form via "Enter" key, and have it activate the ieButtonFix functions.




          Bug # 7
          Invoking OnWebChangePassword() event inside of ActivateUser() was throwing an error...when an actual "OnWebChangePassword" System Event is defined.... This is because the OnWebChangePassword() function is missing global $modx:
          Solution # 7
          global $modx;
          

            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

            Bug # 8

            The ResetPassword() function allows for an empty Email address string to be submitted, which probably shouldn’t happen. In my case, I actually have a few users with NO email addresses, and as a result this invokes $Reset->Send() and then fails since the email address is empty. It should at least ensure a valid value is submitted, possibly confirming via RegEx if it is an email address...but at least not allow empty...

            Solution # 8

            In webloginpe.class.php go to function ResetPassword() and find:
            		$email = $modx->db->escape($_POST['email']);
            


            ...and change it to this:
            		$email = $modx->db->escape(trim($_POST['email'])); // pixelchutes
            		if ( empty($email) ) return $this->FormatMessage($this->LanguageArray[0]); // pixelchutes
            
              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
              Bug # 9

              If you want to leverage System Events for custom validation/processing, you will soon find the need to interact with the calling $wlpe object. Things like, error reporting, etc...

              However, the way System Events are currently invoked there is no tie between the plugin code that gets ran and the instance of WLPE that invoked the code in the first place.

              Important Solution # 9
              This worked very well for me: (Thank you, OpenGeek!)

              Add a "wlpe" key to the $parameters array, and map it to &$this.

              By creating a reference to the $this and passing in the $parameters array sent to $modx->invokeEvent, your plugin code can then interact with the instance $wlpe smiley

              Example: Rewritten OnBeforeWebSaveUser WLPE function
              	function OnBeforeWebSaveUser($Attributes = array(), $ExtendedFields = array())
              	{
              		global $modx;
              
              		$parameters = array(
              			'wlpe'	=> &$this, // pixelchutes - reference $wlpe instance
              			'Attributes'	=> $Attributes,
              			'ExtendedFields'=> $ExtendedFields
              			);
              		 
              		$modx->invokeEvent('OnBeforeWebSaveUser', $parameters ); // pixelchutes
              	}
              


              Then, in my plugin code, I simply reference
              $wlpe

              e.g.
              //<?php
              
                          if( trim( $_POST['email'] ) == '' ){
                              $wlpe->FormatMessage( $wlpe->LanguageArray[0] );
                              
                              return;
                          }
              


              All WLPE System Event functions may need to be updated to provide this needed functionality

              NOTE: In webloginpe.class.php, there are 6 occasions where "$paramaters" and "$parameters" are used... (NOTE: different spellings)
              I have updated all instances of $paramaters with $parameters in my version...FYI.
                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 #57, 19 years ago
                Wow, I sorta forgot about passing $this.

                Adn oh my damm... my spleing is atroechus!  tongue

                I gotta admit, I am a little surprised that BOTH instances of "parameters" are not spelled incorrectly.  grin
                It reminds me of a funny little Cocoa story.

                In Xcode, when using AppleScript Studio to script applications, one of the things you can do is add toolbars to apps or add toolbar items to an application’s existing toolbar. If you want to add an item, you add it by it’s framework identifier. Unfortunately, if you spell things correctly, you are going to be in trouble for "Flexible spaces" and "Customize Toolbar" icons in the toolbar.

                In AppleScript Studio, adding those things to a toolbar would look like this:
                Quote from: AppleScript

                set default identifiers of windowToolbar to {"flexible space item identifer","customize toolbar item identifer", "scottyd item identifier"}

                The word "identifier" is misspelled in the framework as "identifer", so if you want to use a flexible space or the customize item, you have to make sure to misspell it.  tongue

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


                  I send pointless little messages
                  • 28033
                  • 925 Posts
                  Is it advisiable to add these at this moment to a current WLPE install?
                    My Snippets
                    -> PopUpChunk v1.0
                    • 26435
                    • 1,193 Posts
                    ScottyDelicious Reply #59, 19 years ago
                    Quote from: Soshite at Oct 10, 2007, 06:20 PM

                    Is it advisiable to add these at this moment to a current WLPE install?
                    If you feel confident modifying webloginpe.class.php with these changes, then feel free to do so. Pixelchute’s fixes are in the release candidate for 1.4.0 and if you change it yourself as he has suggested in this thread, then upgrading when it is release should be trouble free.

                    -sD-
                    Dr. Scotty Delicious, 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 Oct 10, 2007, 08:29 PM

                      Quote from: Soshite at Oct 10, 2007, 06:20 PM

                      Is it advisiable to add these at this moment to a current WLPE install?
                      If you feel confident modifying webloginpe.class.php with these changes, then feel free to do so. Pixelchute’s fixes are in the release candidate for 1.4.0 and if you change it yourself as he has suggested in this thread, then upgrading when it is release should be trouble free.

                      -sD-
                      Dr. Scotty Delicious, DFPA.

                      I am currently running 4 Live sites w/ WLPE 1.3.0 and all of the above fixes. Everything is working great!

                      The hardest part is realizing that many of the bugs I’ve fixed since v1.3.0 are rather spread out...

                      For Example:
                      - Some of the fixes are related to incorrect WLPE default templates (e.g. password.confirm should be password_confirm, etc)
                      - Some of the fixes are with the WLPE Snippet itself (e.g. Forgot Password/Activation and corrected &disableServices logic)
                      - Some of the fixes I have not provided but have mentioned. (E.g. documentation, template examples, )
                      - Many of the fixes are within the webloginpe.class.php file directly, as Scotty mentioned
                      - A few particular solutions (namely surrounding System Events) should be considered interim/incomplete, since I only outlined updating 1 of about 8 of the functions. Also, Scotty agrees the System Event invocation sequence may need reviewing in certain places...which remains TBD.

                      I think heavy testing of common and uncommon WLPE functionality will quickly reveal what needs to be fixed. For example, testing from Firefox I never knew there was any issue with "Forgot Password" form/activation until I started cross-testing in Internet Explorer. IE handles a "period" in a form’s element name differently than FireFox, etc...

                      I’m not sure what’s in the works for v1.4.0, but maybe an interim v.1.3.x release with various fixes should be rolled out for community testing prior to any new up and coming v1.4 features smiley

                      (I’d be happy to review/compare/test prior to public release)
                        Mike Reid - www.pixelchutes.com
                        MODx Ambassador / Contributor
                        [Module] MultiMedia Manager / [Module] SiteSearch / [Snippet] DocPassword / [Plugin] EditArea / We support FoxyCart
                        ________________________________
                        Where every pixel matters.