$showactionlinks = $showactionlinks && $user2realuser;
$systemcontext = context_system::instance();
-// Is the user involved in the conversation?
-// Do they have the ability to read other user's conversations?
-if (!message_current_user_is_involved($user1, $user2) && !has_capability('moodle/site:readallmessages', $systemcontext)) {
+if ($currentuser === false && !has_capability('moodle/site:readallmessages', $systemcontext)) {
print_error('accessdenied','admin');
}