There will be times when you need custom user profile fields that reflects your organisation’s student management system or to capture and display what matters most to the user population on your Moodle server.
When such a requirement arises, here is what you need to do.
Create Custom Profile Fields in Moodle
Custom profile fields can be used in many ways to. You can create custom fields for the following:
- Sport Houses, Pastoral Houses, House System for point system, Residential Houses, Boarding House, University Accomodation, Classes, Additional postal or address information and more
Again, you will need to be logged on as Administrator to do this. To create a new user profile categories and fields go to:
Settings > Site Administration > Users > Account > User Profile Fields
Custom profile fields can be one of the following
- a menu of choices
- text area
- text input
- and may be set to required or not.
The custom fields must have the following:
- unique Short Name
- Name (displayed on the profile page)
The description while optional is useful to complete for your own reference.
Configuration options for custom fields are as follows:
- Is this field required? This is a simply, to make the field mandatory for the user accounts.
- Is this field locked? If enabled, once entered, the user can no longer edit the information.
- Should the data be unique? This could be registration ID, pass or ID number. If this option is enabled, the profile page update will run a validation check on the entry.
- Display on signup page? If open registration and sign-up is enabled, you can choose if the custom field is shown on the registration or signup page.
- Who is this field visible to? The three options are everyone, not visible therefore only to administrators and visible to user.
New profile fields will appear on each user’s profile page unless “Who is this field visible to?” is set to “Not visible” in which case only the administrator can see the field.
The fields can also be displayed on the signup page if “Display on signup page?” is set to “Yes” (although note that they will never be displayed if set to “Not visible”).
You can set the order in which your custom profile fields appear under the associated profile category using the up/down arrows on the User profiles fields page.
Advanced Applications of Custom Fields
Once a custom field is created, you can also apply this in the ‘Upload user’ process when creating new users or updating existing users.
e.g. taken from Moodle.org
A school has eight houses, named after its founders: Adderton, Coolock, Gorry, Loretto, McAuley, Mercedes, Tighe and Whitty. The site administrator can add a user profile field that offers a ‘Menu of choices’ to the user. A default value can also be selected. If the administrator decides to bulk upload House data for users via a .csv file, it is important to represent the above array of values as 1,2,3,4,5,6,7,8 in the file. That is to state, if a user belongs to Adderton House, the value ‘1’ should be entered for the ‘House’ user profile field in the given record.
Certain fields can be used by Moodle for administrative purposes or conditional access, see Restrict Access Based on Moodle User Profile Fields.