This tutorial builds the Basic Setup and User Profiles tutorials. Do not attempt this tutorial until you've gotten the other login flows setup and working on your site! In this tutorial, you will see how to add extended fields to your users' profiles.
So what going to do in this tutorial is to modify the Snippets that we've already put in place in the standard User Profiles tutorial.
We're not creating any new pages here, but for reference, here are the pages we're dealing with (same as the previous tutorials):
- Login Page (1) : the page containing your login form
- Forgot Password (2) : the page where users can go when they forgot their password
- Reset Password Handler (3) : the hidden page that will actually do the resetting of the password
- Members Home Page (4) : the secret clubhouse, available only to valid members
- Come Again Soon (5) : the page displayed upon successful logout
- Request Membership (6) : the page where users can request membership, i.e. the "Become a Member" page.
- Request Pending (7) : notifies the user that the user's request has been received
- Membership Confirmation Handler (8) : the hidden page that will actually register the user
- Home Page (9) : we're just being thorough – you probably already some page designated as your home page.
- Update Profile (10) – where the user can edit their profile
- View Profile (11) – where the user can view their profile
- Change Password (12) – where the user can change their password.
Just so you know what we're talking about here, we're talking about a user's extended fields. If you edit a user, e.g. the one you created while testing out your login process (Security -> Manage Users -> Right-click your user), head over to the Extended Fields tab and you can see any custom user fields.
In the screenshot, you can see that our earlier shenanigans created a few extra fields! See this forum post.
The point is this: any field you add here will be available as a placeholder in your profile.
|You will probably want to add the extended fields to your membership sign-up form so they can be created from the get-go. If you only want users to be able to add extended fields after they've registered, then you can skip this.|
Your request membership form will look a lot like what we're going to build for the Update Profile form. We're merely adding the extra fields to the form that was already in place from the previous tutorial. Here we've added a field named "custom_field":
Make sure you reference the correct Email Chunk in the &activationEmailTpl parameter. In this example, we're using Login's default name, lgnActivateEmailTpl.
We're gonna edit this page to use some more of features of the UpdateProfile Snippet. We're going to add a "custom_field". We're going to verbosely set the &useExtended parameter. This ensures that any extra fields posted here end up getting tracked as extended fields.
Why are we using the &excludeExtended parameter? Well... there seems to be a bug in the Login Snippet where these fields with validation rules.
As before, we will be featuring the Profile Snippet. We just need to add placeholders for the extra fields. In our example we added a custom_field field:
Using a separate browser, you need to log into the front-end. This stuff should work from the previous tutorial.
- CHECK: This page should display your info, including the custom_field value (or values).
Try changing your info.
- CHECK: Can you edit your info? Try changing the custom_field value(s) and saving.
The FormIt Snippet has a useful helper Snippet: FormItCountryOptions. If you want to track a user's country, it can be a great way to add a country dropdown.
There is a similar Snippet for US State options: FormItStateOptions