diff --git a/mod/forum/lib.php b/mod/forum/lib.php
index 8b98b7e065d..9b051a91bda 100644
--- a/mod/forum/lib.php
+++ b/mod/forum/lib.php
@@ -3877,14 +3877,18 @@ function forum_print_discussion_header(&$post, $forum, $group=-1, $datestring=""
echo '
';
$usedate = (empty($post->timemodified)) ? $post->modified : $post->timemodified; // Just in case
- $parenturl = (empty($post->lastpostid)) ? '' : '&parent='.$post->lastpostid;
+ $parenturl = '';
$usermodified = new stdClass();
$usermodified->id = $post->usermodified;
$usermodified = username_load_fields_from_object($usermodified, $post, 'um');
+
+ // Show link to last poster and their post if user can see them.
if ($canviewparticipants) {
echo ''.
fullname($usermodified).' ';
+ $parenturl = (empty($post->lastpostid)) ? '' : '&parent='.$post->lastpostid;
}
+
echo ''.
userdate($usedate, $datestring).'';
echo " | \n";