diff --git a/user/view.php b/user/view.php
index c5f2b784df7..6b6c048056f 100644
--- a/user/view.php
+++ b/user/view.php
@@ -77,7 +77,7 @@
}
if (!has_capability('moodle/course:view', $coursecontext, $user->id, false)) {
- if (has_capability('moodle/course:view', $coursecontext)) {
+ if (has_capability('moodle/role:assign', $coursecontext)) {
print_header("$strpersonalprofile: ", "$strpersonalprofile: ",
"id\">$course->shortname ->
id\">$strparticipants -> $fullname",