diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html
index f4a79411d1..70026d724b 100644
--- a/phpBB/docs/CHANGELOG.html
+++ b/phpBB/docs/CHANGELOG.html
@@ -186,6 +186,7 @@
[Change] Add confirmation for deactivating language packs (Patch by leviatan21)
[Change] Add confirm-box when deleting permissions (Bug #13673 - Patch by nickvergessen)
[Change] Add pagination for icons and smilies in the ACP and smilies in the smiley popup
+ [Change] Cache get_username_string() function calls on viewtopic.
[Feature] Add language selection on the registration terms page (Bug #15085 - Patch by leviatan21)
[Feature] Backported 3.2 captcha plugins.
[Feature] Introduced new ACM plugins:
diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php
index 0ddf8603fc..f3f6923381 100644
--- a/phpBB/viewtopic.php
+++ b/phpBB/viewtopic.php
@@ -1116,6 +1116,11 @@ while ($row = $db->sql_fetchrow($result))
'yim' => ($row['user_yim']) ? 'http://edit.yahoo.com/config/send_webmesg?.target=' . urlencode($row['user_yim']) . '&.src=pg' : '',
'jabber' => ($row['user_jabber'] && $auth->acl_get('u_sendim')) ? append_sid("{$phpbb_root_path}memberlist.$phpEx", "mode=contact&action=jabber&u=$poster_id") : '',
'search' => ($auth->acl_get('u_search')) ? append_sid("{$phpbb_root_path}search.$phpEx", "author_id=$poster_id&sr=posts") : '',
+
+ 'author_full' => get_username_string('full', $poster_id, $row['username'], $row['user_colour']),
+ 'author_colour' => get_username_string('colour', $poster_id, $row['username'], $row['user_colour']),
+ 'author_username' => get_username_string('username', $poster_id, $row['username'], $row['user_colour']),
+ 'author_profile' => get_username_string('profile', $poster_id, $row['username'], $row['user_colour']),
);
get_user_rank($row['user_rank'], $row['user_posts'], $user_cache[$poster_id]['rank_title'], $user_cache[$poster_id]['rank_image'], $user_cache[$poster_id]['rank_image_src']);
@@ -1434,10 +1439,10 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i)
//
$postrow = array(
- 'POST_AUTHOR_FULL' => get_username_string('full', $poster_id, $row['username'], $row['user_colour'], $row['post_username']),
- 'POST_AUTHOR_COLOUR' => get_username_string('colour', $poster_id, $row['username'], $row['user_colour'], $row['post_username']),
- 'POST_AUTHOR' => get_username_string('username', $poster_id, $row['username'], $row['user_colour'], $row['post_username']),
- 'U_POST_AUTHOR' => get_username_string('profile', $poster_id, $row['username'], $row['user_colour'], $row['post_username']),
+ 'POST_AUTHOR_FULL' => ($poster_id != ANONYMOUS) ? $user_cache[$poster_id]['author_full'] : get_username_string('full', $poster_id, $row['username'], $row['user_colour'], $row['post_username']),
+ 'POST_AUTHOR_COLOUR' => ($poster_id != ANONYMOUS) ? $user_cache[$poster_id]['author_colour'] : get_username_string('colour', $poster_id, $row['username'], $row['user_colour'], $row['post_username']),
+ 'POST_AUTHOR' => ($poster_id != ANONYMOUS) ? $user_cache[$poster_id]['author_username'] : get_username_string('username', $poster_id, $row['username'], $row['user_colour'], $row['post_username']),
+ 'U_POST_AUTHOR' => ($poster_id != ANONYMOUS) ? $user_cache[$poster_id]['author_profile'] : get_username_string('profile', $poster_id, $row['username'], $row['user_colour'], $row['post_username']),
'RANK_TITLE' => $user_cache[$poster_id]['rank_title'],
'RANK_IMG' => $user_cache[$poster_id]['rank_image'],