- Create a custom profile field and set it to "required."
- Do not lock the field.
- Enroll a student in a course.
- Student deletes the data from the custom profile field.
- Student logs out.
- Student logs in and can no longer see anything except his/her own profile.
I had set up the custom user field when using an older version of Moodle (3.8?). A single student (so far) experienced this problem, as did I when, with the student's permission, I used the log-in-as function. All of the student's data were intact.
I created another profile for the student to enable work to continue. Then I compared the data in the "xxx_user" field in the database for the two records, but all were the same. Next I compared permission for the "two" users, but all were identical. Finally, I compared profile pages for the users and noticed there was no entry for the required custom user profile field in the older account. I next changed that custom field to not required, and the old account worked.
(I am afraid I have no idea if this counts as a bug or not.)