One of the most annoying things about the Moodle messaging system is that when a user receives a message from a user who has blocked them it doesn’t show.
The message windows still pops up and says there is a message waiting but the user in unable to read it.
Many of our students complained about this as the pop-ups become increasingly annoying.
To fix this I changed the code in /message/discussion.php
I removed the initial check which looks for the blocked user so that the message appears, this allows the user to read the message, so the pop-ups disappear.
I then wrote a simple if/else statement that checks if the user is blocked and therefore does not show the message editor window and the user cannot send a message to someone who has blocked them.Sounds confusing? And it was? But it works brilliantly.