We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 11712
    • 8 Posts
    Hello,

    I’m using WLPE for logging in and profile editing and I must say everything was easy to set up and works fine.

    But I’m looking for a solution to make some fields mandatory in profile editing (email for example)
    As it is made, the system doesn’t avoid a user to erase his email for example.
    I’ve tried with the parameter &regRequired, but it doesn’t work (I guess it’s made for registering only)

    My snippet call :

    [!WebLoginPE? &lang=`en` &type=`profile` &userImage=`1000000,500,500` &dateFormat=`%d-%m-%Y` &customFields=`adresse,ville,licence,objectifsaison` &profileTpl=`WLPEUserProfil`!]


    My &profileTpl chunk :
    <p>[+wlpe.message+]</p>
    <form enctype="multipart/form-data" id="wlpeUserProfileForm" action="[~[*id*]~]" method="POST">
    <p>
    <table align="center" width="100%" valign="top">
      <tr>
        <td valign="top" align="left">
         <font color="#395e7b" ><b><h2>[+user.fullname+] ([+user.username+])</h2></b></font> 
         <table valign="top" align="left">
    
           <tr>
            <label for="wlpeUserProfileAdresse">
             <td><b>Adresse :</b></td>
             <td><TEXTAREA rows="3" cols="30" name="adresse">[+user.adresse+]</textarea></td>
            </label>
           </tr>
           <tr>
            <label for="wlpeUserProfileCP">
             <td><b>Code Postal :</b></td>
             <td><input id="wlpeUserProfileCP" type="text" size="6" maxlength="5" name="zip" value="[+user.zip+]" /></td>
            </label>
           </tr>
           <tr>
            <label for="wlpeUserProfileVille">
             <td><b>Ville :</b></td>
             <td><input id="wlpeUserProfileVille" type="text" name="ville" value="[+user.ville+]" /></td>
            </label>
           </tr>
           <tr>
            <label for="wlpeUserProfileEmail">
            <td><b>Email :</b></td
            <td><input id="wlpeUserProfileEmail" type="text" size="30" name="email" value="[+user.email+]" /></td>
            </label>
           </tr>
           <tr>
            <label for="wlpeUserProfilePhone">
             <td><b>Tel Fixe :</b></td>
             <td><input id="wlpeUserProfilePhone" type="text" size="20" name="phone" value="[+user.phone+]" /></td>
            </label>
           </tr>
           <tr>     
            <label for="wlpeUserProfileMobile">
             <td><b>Tel Mobile :</b></td>
             <td><input id="wlpeUserProfileMobile" type="text" size="20" name="mobilephone" value="[+user.mobilephone+]" /></td>
            </label>
           </tr>
           <tr>      
            <label for="wlpeUserProfileDob">
             <td><b>Date de naissance :<br><font size="1">(MM-JJ-AAAA)</font></b></td>
             <td><input id="wlpeUserProfileDob" type="text" name="dob" value="[+user.dob+]" /></td>
            </label>
           </tr>
           <tr>      
            <label for="wlpeUserProfileLicence">
             <td><b>N° de Licence :</b></td>
             <td><input id="wlpeUserProfileLicence" type="text" size="30" name="licence" value="[+user.licence+]" /></td>
            </label>
           </tr>
           <tr>
            <label for="wlpeUserProfileObjectifSaison">
             <td><b>Objectif de la saison :</b></td>
             <td><TEXTAREA rows="3" cols="30" name="objectifsaison">[+user.objectifsaison+]</textarea></td>
            </label>
           </tr>
           <tr>
            <label for="wlpeUserProfilePhoto" id="wlpeUserPhotoLabel">
             <td><b>Photo :<br><font size="1">(Max 1Mo, 500x500)</font></b></td>
             <td><input type="hidden" id="wlpeUserHiddenPhoto" name="userphoto" value="[+user.photo+]" />
                 <input id="wlpeUserProfilePhoto" type="file" name="photo" value="" /></td>
            </label>
           </tr>
         </table> 
        </td>
        <td align="right">
             <img src="[+user.photo+]" alt="[+user.photo+]" title="[+user.username+]" border="2px" vspace="4px" width="400px">
        </td>
      </tr>
    </table>
    </p>
    <p>
    <b>Changer de mot de passe :</b><br>
    <font size="1">(laisser vide pour conserver le mot de passe actuel)</font><br>
    
    <label for="wlpeUserProfilePassword">Nouveau mot de passe
    <input id="wlpeUserProfilePassword" type="password" name="password" value="" />
    </label>
    <br>
    <label for="wlpeUserProfilePasswordConfirm">Nouveau mot de passe
    <input id="wlpeUserProfilePasswordConfirm" type="password" name="password.confirm" value="" /><font size="1">(confirmation)</font>
    </label>
    </p>
    <p>
    <input type="hidden" id="wlpeUserHiddenFullname" name="fullname" value="[+user.fullname+]" />
    <input type="hidden" id="wlpeUserHiddenGender" name="gender" value="[+user.gender.integer+]" />
    <input type="hidden" id="wlpeUserHiddenCountry" name="country" value="[+user.country.integer+]" />
    <input type="hidden" id="wlpeUserHiddenState" name="state" value="[+user.state+]" />
    <input type="hidden" id="wlpeUserHiddenFax" name="fax" value="[+user.fax+]" />
    <input type="hidden" id="wlpeUserHiddenComment" name="comment" value="[+user.comment+]" />
    <button type="submit" id="wlpeSaveProfileButton" name="service" value="saveprofile">Sauvegarder</button>
    <button type="submit" id="wlpeProfileDoneButton" name="service" value="cancel">Annuler</button>
    </p>
    </form>  


    Did some of you face the same problematic ? Any help would be very appreciated wink
    Thanks,
    Olivier
      • 5253
      • 17 Posts
      hehe... a few days ago i have had the same problem... But I’ve no idea to solve this....
      Another feature would be cool: Changing you re-mail address requires a new activation...
      a quick&dirty workaround: Just set these fields to read-only... with a short notice that only admins can change these values...
      Not a perfect soluion but a comfortable one smiley

      cheers
        *there are no strangers - just friends who never met*
        • 4310
        • 2,310 Posts
        This is untested so make a backup of the file first, try replacing this at around line 833 of assets/snippets/webloginpe/webloginpe.class.php :
        		// EVENT: OnBeforeWebSaveUser
        		$this->OnBeforeWebSaveUser(array(), array()); // pixelchutes
        		if ( !empty($this->Report) ) return; // pixelchutes
        

        With this :
        		// EVENT: OnBeforeWebSaveUser
        		$this->OnBeforeWebSaveUser(array(), array()); // pixelchutes
        		if ( !empty($this->Report) ) return; // pixelchutes
                        if (empty($_POST['email']))
        		{
        		$this->FormatMessage($this->LanguageArray[88]);
        		return;
        		}
        

        Then in assets/snippets/webloginpe/lang/en.php ( or whatever your language file is ) add something like this :
        	$wlpe_lang[88] = 'You have left the email field blank.';
        

          • 11712
          • 8 Posts
          Thanks a lot, I try this and let you know wink
            • 11712
            • 8 Posts
            It works fine. Only a ")" was missing in the "if" condition

            Here the code :

            $this->OnBeforeWebSaveUser(array(), array()); // pixelchutes
            		if ( !empty($this->Report) ) return; // pixelchutes
                            if (empty($_POST['email']))                // EMAIL REQUIRED
            		{                                         // EMAIL REQUIRED
            		$this->FormatMessage($this->LanguageArray[88]);   // EMAIL REQUIRED
            		return;                                    // EMAIL REQUIRED
            		}


            THANKS A LOT cool
              • 4310
              • 2,310 Posts
              Great it worked smiley
              I’ve edited my post to add the missing )