We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 8091
    • 14 Posts
    I’m trying to create some additional fields for the Web-user sign-up but I’m not quite sure how to get it to work. I can add the extra form fields in the Web-sign-up chunk, I have also added the extra columns to the Web user attributes table in the database. But I do not know how to get the snippet to grab the information submitted in the form and save it to the database.

    Can anyone help me out?

    Thanks

    Roger
      • 24719
      • 194 Posts
      you’ll need to edit /assets/snippets/weblogin/websignup.inc.php. use it to access the POST data and save it to the database.

      it’s not a particularly good idea to add columns to the default tables though because this can make it more difficult to upgrade and it doesn’t future-proof very well. it’s better to create a new table and put your extra data in that.
        • 8091
        • 14 Posts
        Thanks, and I’ll go and remove the change to the default table too and take your advice about creating a new table for extra preferences.
          • 14714
          • 84 Posts
          i am trying to do the same and with no php skills- can anyone point me in the right direction.
          thanks
          jordan
            • 32894
            • 21 Posts
            I’m also trying to do the same, however for this particular project Modx upgrades won’t be necessary. Anyone know of a decent thread where this has been discussed, there must have been some, however when I searched my results weren’t brilliant.

              • 27442
              • 103 Posts
              The WebLoginPE snippet has the capability to add additional user information fields.
                • 20413
                • 2,877 Posts
                I use custom db tables and have users work with them through [ eform2db ] + http://wiki.modxcms.com/index.php/DB_query_and_Placeholders
                Then I use [ dbedit ] module to manage the whole thing nice from inside MODx! E-mail me: mrhaw _ hotmail.com for help if u want. When time exist
                I will make a online tutorial for this...
                  @hawproductions | http://mrhaw.com/

                  Infograph: MODX Advanced Install in 7 steps:
                  http://forums.modx.com/thread/96954/infograph-modx-advanced-install-in-7-steps

                  Recap: Portland, OR (PDX) MODX CMS Meetup, Oct 6, 2015. US Bancorp Tower
                  http://mrhaw.com/modx_portland_oregon_pdx_modx_cms_meetup_oct_2015_us_bancorp_tower
                  • 8454
                  • 55 Posts
                  Maybe it’s too late in the evening, but I’m stuck. Being a newbie I can’t figure out the best way to add custom web user fields (or site user fields). I hoped it would be as easy as adding a TV (template variable) to documents.

                  Are any custom fields for users to be defined manually in the SQL database back-end? I really tried to get it from the WebLoginPE documentation (http://svn.modxcms.com/crucible/browse/~raw,r=37/modx-components/webloginpe/trunk/assets/snippets/webloginpe/docs/parameters.html). Dr. Scotty’s documentation on the snippet is really quite extensive, and covers calling a customFields parameter, but I just can’t figure out how and where to define the db fields in the first place.

                  @mrhaw: I can’t even grasp the DB_query_and_Placeholders wiki just yet. Sorry, I am trying hard but learning slowly...
                  btw: I can’t code php.

                  If there is any reasonably accessible alternative documentation on WebLoginPE (or alternative snippet w. tutorial) out there I’d be grateful for any hint. I’m not hoping for a tutorial as amazingly brilliant and philantropic as kongondos fresh one on Wayfinder http://modxcms.com/forums/index.php/topic,34176.0.html but jumping from installation instructions straight into parameter settings is simply above my limited capacity.
                    • 8454
                    • 55 Posts
                    OK, so I duct taped my eyelids and browsed on.

                    @other.newbies.like.me: this post clarified things somewhat:http://modxcms.com/forums/index.php/topic,25202.0.html. Custom fields populates the db just by getting called (magic!). Copy rossco’s code at reply #15 and experiment.

                    Outstanding question: I can’t figure out how to access the custom fields for later review. I get the impression from other posts that they will not be easily accessed via the back-end manager, but a regular "edit profile page" as outlined in the documentation would do fine.

                    If anyone has got an example call to share I’d spare hours of incompetent trial & error fuzz. - i.e. a complete [!WebLoginPE? etc.etc] + chunks or whatever resulting in an edit profile page w the custom fields.

                    I tried:
                    [!WebLoginPE? &type=`profile`  &profileTpl=`MyCustomProfileTpl`  &customFields=`shoesize`!]

                    where MyCustomProfileTpl was a duplicate of the webloginpe/Default Forms/defaultProfileTpl.html.txt with this addition in between the other labels:
                    			<label for="wlpeUserProfileShoesize">Shoesize
                    			<input id="wlpeUserProfileShoesize" type="text" name="shoesize" value="[+user.shoesize+]" />
                    			</label>

                    Comes out undigested like this: [[WebLoginPE? &type=`profile` &profileTpl=`MyCustomProfileTpl` &customFields=`shoesize`]]
                      • 27442
                      • 103 Posts
                      I know it’s a little late, but if you still woud like some examples of how to do this, here’s something that I’ve used on a class reunion site. I usually use chunks for these calls, because I had cases where the RTE has messed up some of the parameters. In addition, with very long calls, the content page where it’s used, looks much cleaner with a simple chunk reference. In the code sections below, I’ve added some unneccessary spacing for clarity in this posting. Normally, you wouldn’t do this.

                      The SignUp call. Here I used instant registration, but put the new user into a special WebUser group that has limited access to the site. A couple admins are notified by e-mail (masked here) and if they know this webuser, they change the group memebership to a full access group (which you’ll see further down in this post). CustomFields are used to pick up additional information (in most cases, both a piece of information and wether or not the webuser wants to keep it private). Here, you may notice that I’m collecting first, last, and married [sur]name. Since it’s possible that a woman has taken a new married last name from the time that she was in school, I use these fields with a slightly modified version of WebLoginPE to create the webuser account full name first (last) married where applicable, otherwise first last. The inputHandlers set checkbox options to keep the info private. And the other stuff is pretty standard. See the attached ’SignUpForm.txt’ for the SignUpForm chunk.

                      <p>[!WebLoginPE? &type=`register` &regType=`instant` &registerTpl=`SignUpForm` &groups=`Pending Users`
                      
                      &customFields=`firstname,lastname,marriedname,emailprivate,phoneprivate,mobilephoneprivate,address1private,dobprivate,website,aim,aimprivate,
                      msn,msnprivate,yahoo,yahooprivate,myspace,myspaceprivate,facebook,facebookprivate,city,address1` 
                      
                      &inputHandler=`Keep private:userProfileEmailPrivate:emailprivate:checkbox:()||Keep private:userProfilePhonePrivate:phoneprivate:checkbox:()||
                      Keep private:userProfileMobilePhonePrivate:mobilephoneprivate:checkbox:()||Keep private:userProfileAddress1Private:address1private:checkbox:()||
                      Keep private:userProfileDOBPrivate:dobprivate:checkbox:()||Keep private:userProfileAIMPrivate:aimprivate:checkbox:() ||
                      Keep private:userProfileMSNPrivate:msnprivate:checkbox:()||Keep private:userProfileYahooPrivate:yahooprivate:checkbox:()||
                      Keep private:userProfileMyspacePrivate:myspaceprivate:checkbox:()||Keep private:userProfileFacebookPrivate:facebookprivate:checkbox:()` 
                      
                      &notify=`[email protected],[email protected]` &notifyTpl=`NotifyAdmin` &pruneDays=`365` 
                      &regSuccessId=`57` &regSuccessPause=`0`
                      &regRequired=`email,username,firstname,lastname,password,tos`
                      &liHomeId=`56,48`!]</p>


                      For logged in, confirmed users, the user listing call is sorted by last name and only displays members of the confirmed group. I have not attached the ’ListUsers’ chunk, because there’s really nothing interesting about that, but see the attached ’UserDetail.txt’ file for the UserDetail chunk used for individual details when a user is clicked.
                      <p>[!WebLoginPE? &type=`users` &usersList=` :default:ListUsers:lastname:ASC:webgroup(Confirmed Alumni)` &viewProfileTpl=`UserDetail`!]</p>



                      The individual user update call, where the user updates their profile information has nearly the same parameters as the SignUp call. See the attached ’UpdateForm.txt’ for the form.
                      <p>
                      [!WebLoginPE? &type=`profile` &profileTpl=`UpdateForm`
                      
                      &customFields=`firstname,lastname,marriedname,emailprivate,phoneprivate,mobilephoneprivate,address1private,dobprivate,website,aim,aimprivate,
                      msn,msnprivate,yahoo,yahooprivate,myspace,myspaceprivate,facebook,facebookprivate,city,address1`
                      
                      &inputHandler=`Keep private:userProfileEmailPrivate:emailprivate:checkbox:()||Keep private:userProfilePhonePrivate:phoneprivate:checkbox:()||
                      Keep private:userProfileMobilePhonePrivate:mobilephoneprivate:checkbox:()||Keep private:userProfileAddress1Private:address1private:checkbox:()||
                      Keep private:userProfileDOBPrivate:dobprivate:checkbox:()||Keep private:userProfileAIMPrivate:aimprivate:checkbox:() ||
                      Keep private:userProfileMSNPrivate:msnprivate:checkbox:()||Keep private:userProfileYahooPrivate:yahooprivate:checkbox:()||
                      Keep private:userProfileMyspacePrivate:myspaceprivate:checkbox:()||Keep private:userProfileFacebookPrivate:facebookprivate:checkbox:()` !]
                      </p>


                      Hope that helps.