How to force users to log in before viewing default content in Moodle 4.x


This post has been updated to reflect changes in Moodle 4.x

By default, Moodle’s Front page usually contains a list of available courses, news items and some Moodle blocks depending on the site’s configuration, and the default Moodle content on the page can be viewed by all the site’s visitors. Some of our clients wanted to prevent anonymous site visitors from seeing any of Moodle’s default content (eg. available Moodle courses), and asked us if it is possible to force users to log in to view Moodle content. The answer is Yes and it is actually really easy to do in Moodle.

Step 1

Log into your Moodle site as an admin user, and navigate to the Site security settings option by going to Site administration > Security > Site security settings


Step 2

Tick the “Force users to login” option checkbox.


Step 3

Click the “Save changes” button. Now, if you log out and try to access your Moodle site again, you will need to log in first before viewing any Moodle content.