Without writing a single line of code to change the view or disabling moodle/user:viewalldetails to stop students from accessing the profile page completely, here are steps to hide user fields containing sensitive information on other student’s profile page in Moodle.
Moodle is giving away too much information on the user’s profile page. They include email address, last access time, down to last known IP address. And, if you have set moodle/user:viewalldetails to Allow in Users > Permissions > Define roles for Student this will mean students can see each others profile page. You can of course remove their access to the Profile page other than their own completely by removing the Allow permission (third line in the screenshot below). But this would remove the option to send direct message.
User profile page reveals too much information such as Login activity and Email Address, see below.
Steps to Hide Fields on User’s Profile Page
Here is how to hide fields like Email address and all the information under Login activity.
- Login to Moodle with administrative access
- Go to Site Administration
- Click the User tab
- Click on User policies under Permissions
- Scroll down to Hide user fields, hold down the CTRL key and click on the fields you wish to hide for users
- Next, go to Show user identity and uncheck Email address
- When you are ready, scroll to the bottom and click Save Changes
The result, a more streamlined user profile page with little user identifiable information. Even when a user tries to view “Full profile” under Miscellaneous section on the profile page, see below, it will still present a restricted view.