How to disable self enrolment in a Moodle course?

To disable self enrollment manually in a Moodle course, the teacher can follow the steps below.

1. In Moodle course, navigate to "Administration" block > Users > Enrolment methods


2. At the row of "Self enrolment (Student)", click the delete button as shown below. Deleting the self enrolment method will delete all self enrolled students and their associated past activities in the Moodle course. And, the Moodle course will no longer accept self enrollment.