Moodle Monday: Banning users from messaging by @timdalton

1
2114

We like the Moodle message block, but it can be open to student misuse. This simple little trick allows you to create a new role that stops certain users from using the message block. You could use this to ban particular students, or whole groups of users.

The Moodle permission system has a set of rules about what certain types of users are allowed to do. It calls these roles. There is a teacher role (allowed to create and edit content), a student role (allowed to view content), and a few others. The default system roles are well set up (you can tell this as you probably haven’t changed them), but you can also create your own. What we want to do is take an existing role and just modify it to remove the message capability.

To do this:

  1. In the site admin menu go users-permissions-define roles.
  2. Select the ‘Authenticated user’ role.
  3. Click the ‘duplicate role’ button. It will ask if you are sure you want to do this.
  4. Your duplicate role will appear on the list, click the edit button.
  5. Rename the role (something like ‘banned from messaging’)
  6. Now, search the list of permissions for the ones related to messaging. There are 2 you need to find: Read all messages on site, Send messages to any user.
  7. Change the tick box next to these two to PROHIBIT and save you changes.

These steps will have left you with a role that will allow you to ban students from messaging. The reason we used prohibit rather than prevent is that this stops them from using messaging even if they have a higher level of role somewhere else on the site. So, if they are set as students in other courses they will still be banned from messaging there too.

The last part of the job is to assign your banned students to the role. Again in your admin menu, go users-permissions-assign system roles. Select the banned from messaging role and add the students to it. This completes the job.