Conditional user fields


目录

Enabling the use of restrict access sitewide | ]

To use the restrict access feature, it must be enabled by an administrator by checking the "Enable restricted access" box in Site administration > Advanced features. A restrict access section will then appear for teachers on the Activity settings screen, with an 'Add restriction' button. This section applies to all activities and resources, and is the second to last section in each activities settings area, above Activity completion (if it has been turned on).

Enabling or disabling specific restrictions | ]

In Site administration > Plugins > Availability restrictions > Manage restrictions you can toggle to enable or disable any of the individual restriction types for use throughout the site. You can also specify the default display mode of an access restriction, i.e., whether it is hidden ('eye' closed) or visible ('eye' open).

45restrictaccess.png

Restricting activity access | ]

In the settings of each activity there is a Restrict Access section. To get to this, click 'Edit' alongside the activity you want to restrict and then choose 'Edit Settings', or add a new activity, which will bring you to the settings page.

In the 'Restrict Access' section of the activity settings page, click the 'Add restriction' button. A choice of conditions appears:

400px-add_restriction_popup.png

Restriction can be based upon Activity completion, date, grade, the group or grouping the students are in or even user profile fields. The 'Restriction set' button also allows for more complex criteria requiring nested conditions.

Activity completion | ]

See Activity completion. Note that this button only appears if you have Activity completion enabled by the administrator in your site, and it is enabled in your course in Course administration > Edit settings > Completion tracking.

Instead of selecting a specific activity or resources, access may be restricted to "Previous activity with completion".

Date | ]

Access can be restricted from or until a certain date and time.

500px-availabilityrestrictionbydatefromuntil_m30.png

Grade | ]

You can specify a condition on any grade in the course: the full course grade, the grade for any activity, or a custom grade that you create manually. You can enter either a minimum value (at least percentage), a maximum value (less than percentage), both, or neither. The activity will only appear if the student has a value for the specified grade, and if it falls within any specified number range. You can add more than one grade condition. All conditions must be met in order for the activity to appear.

Group and groupings | ]

If groups or groupings are used in the course, it is possible to restrict the activity to a certain group or grouping. If they are turned off for this course and not available, these options will not be present for use as an restriction.

300px-grouprestrict.png

NOTE: This button only appears if you have groups enabled in your course.

User profile | ]

Access can be restricted using one of the following standard profile user fields:

In addition, you can choose any custom user profile fields if you have created any.

Restriction set | ]

This allows you to add a set of complex restrictions to apply complex logic. See Using restrict access for an example.

Hiding the conditions | ]

The shut eye takes precedence. For example, you could have 2 conditions, one based on date (with eye shut) and one based on completing a previous activity (with eye open). That way, the activity will not appear at all until the date; then it will appear, but tell you that you need to complete the other activity; then when you complete the other activity you can access it.

For OR and NOT AND type conditions, you only get a single eye icon instead of one for each condition

daterestrict1.png

The eye also affects to the visibility of the activity in the gradebook:

ALL or ANY Conditions | ]

Further restrictions may be added by clicking the 'Add restriction' button again, and it is possible to specify that ALL the conditions or ANY of the conditions are required before the activity is made available. Thus, it is possible to use 'Or' as well as 'And' conditions. See Using Conditional activities for an example.

400px-AND.png
'and' condition
400px-OR.png
'or' condition

Restricting access to a course section | ]

You can restrict access to all the activities and resources within a course section by specifying the conditions in the settings for that particular section.

Do this by editing the section settings from the three dots action menu > Edit settings.

45_restrictaccessesction.png

Source: docs.moodle.org/503/en/Conditional user fields — MoodleDocs (GPL) · Imported 2026-11-10.


版本号 #1
由 cocobook-sync 创建于 2026-11-10 12:44:01 UTC
由 cocobook-sync 更新于 2026-11-10 12:44:01 UTC