How to Build User Profiles With Fields in Drupal 8
By default, a Drupal 8 user account collects only very basic information about the user.
And, most of that information is not visible to visitors or other users on the site.
Fortunately, Drupal makes it easy to modify and expand this profile so that people can add useful information about themselves such as their real name (versus a username), address, employer, URLs, biography, and more.
If you’re new to how Drupal handles users, read this tutorial before starting. In this tutorial, I’m going how to create expanded user profiles for your Drupal users.
First, let’s add some fields to your user profiles. This allows users to provide more information about themselves.
- Go to “Configuration”, “People”, “Account settings”, and then “Manage fields”. You can now see a screen which looks the one below:
Let’s add the following Text (plain) fields:
- First Name. Set the “Maximum length” to 50 characters.
- Last Name. Set the “Maximum length” to 50 characters.
Next, add the following Link fields:
- Personal Website
- Go to the “Manage display” tab and arrange the new fields in the order you want them to show to site visitors.
- Go to “People” and “Permissions”.
- Give the “View user information” permission to the Anonymous and Authenticated users.
Now, go and see those user profile fields that you just created:
- Click your user name to go to “My account” in the black menu bar at the top.
- Click the “Edit profile” tab.
- Scroll down and you can use all the fields that you just created.
- Fill in the fields.
- Save your data and click the “View” tab to see your profile:
Now, see how these fields appear to your site’s users. For many users, this user profile editing area should look similar, but slightly different:
- You can use the Masquerade module to see the site as the user would. If you’re not familiar with Masquerade, read this tutorial.
- Click the article writer name to go to “My account”.
- Click the “Edit profile” tab and see what the user sees:
Finally, see how this appears to a new user:
- Log out or visit your site in another browser.
- Visit http://[your_web_address]/user/register
- The registration screen should show the default Drupal fields, plus your new fields:
If you want to remove any fields from the registration area, you can hide them by going to “Configuration, “People”, “Account settings”, and then “Manage form display”.
Want to Learn More?
This tutorial was an extract from Drupal 8 Explained, the best-selling guide to Drupal 8. Grab a copy today to learn all the fundamentals of Drupal 8.
Hi, I am working with a distribution called Open Social and have reached out to that community but haven’t gotten a reply, so I thought I’d pose the issue here:
Re: User Profiles (Drupal 8.7.11)
‘/admin/config/people/profile-types/manage/profile’
Does anyone know what must be enabled in order to add and modify the profile fields.
I have worked with these many times including in local instances of the same distribution.
But for the life of me cannot remember what must be enabled to get access to the fields tabs!
Here are two screenshots. One with the fields available and the other without!
Thanks