Moodle Hack: Remove message button from User Profile

The messaging system is often overused (!!!!) by students as a chat system. To reduce the overuse of this system and encourage messaging only within some courses, the message button can be re,moved from the user profile page.

NOTE: Any student can still directly visit the message page URL IF they know the address.

moodle/user/view.php

/* Comment out Line 484 - 506
Remove access to message from login screen ? moodle/user/view.php Line 484 - 506
if (!empty($CFG->messaging) and !isguest() and has_capability('moodle/site:sendmessage', get_context_instance(CONTEXT_SYSTEM))) {
if (!empty($USER->id) and ($USER->id == $user->id)) {
if ($countmessages = count_records('message', 'useridto', $user->id)) {
$messagebuttonname = get_string("messages", "message")."($countmessages)";
} else {
$messagebuttonname = get_string("messages", "message");
}
echo "<form onclick=\"this.target='message'\" action=\"../message/index.php\" method=\"get\">";
echo "<div>";
echo "<input type=\"submit\" value=\"$messagebuttonname\" onclick=\"return openpopup('/message/index.php', 'message', 'menubar=0,location=0,scrollbars,status,resizable,width=400,height=500', 0);\" />";
echo "</div>";
echo "</form>";
} else {
echo "<form onclick=\"this.target='message$user->id'\" action=\"../message/discussion.php\" method=\"get\">";
echo "<div>";
echo "<input type=\"hidden\" name=\"id\" value=\"$user->id\" />";
echo "<input type=\"submit\" value=\"".get_string("sendmessage", "message")."\" onclick=\"return openpopup('/message/discussion.php?id=$user->id', 'message_$user->id', 'menubar=0,location=0,scrollbars,status,resizable,width=400,height=500', 0);\" />";
echo "</div>";
echo "</form>";
}
}
*/

No comments: