How to Create Custom Fields in Moodle and Then Some
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
- checkbox
- 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.
fre
17 June 2020 @ 11:39 am
this article does not answer the question. which is How to Create Custom Fields in Moodle. all what you say is it can be applied to certain types but nothing else.
fre
20 July 2021 @ 12:25 pm
how can i create a custom field with the academic year. the values will be preset as in 20/21; 21/22; 22/23 etc. how can i get the actual value when clicked, currently it will only return an index as in 1,2,3