From dca3a5acab73f2820155362e4f2f69f10cb3afe6 Mon Sep 17 00:00:00 2001
From: JohnAlbin <virtually.johnalbin@gmail.com>
Date: Tue, 21 Jul 2015 12:08:02 +0800
Subject: [PATCH] #2536750: themed username doesn't link to user's own profile.

---
 core/modules/user/user.module | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/core/modules/user/user.module b/core/modules/user/user.module
index b157f1f..11d782f 100644
--- a/core/modules/user/user.module
+++ b/core/modules/user/user.module
@@ -447,6 +447,7 @@ function user_template_preprocess_default_variables_alter(&$variables) {
  */
 function template_preprocess_username(&$variables) {
   $account = $variables['account'] ?: new AnonymousUserSession();
+  $user = \Drupal::currentUser();
 
   $variables['extra'] = '';
   $variables['uid'] = $account->id();
@@ -474,7 +475,7 @@ function template_preprocess_username(&$variables) {
 
   $external = FALSE;
   // Populate link path and attributes if appropriate.
-  if ($variables['uid'] && $variables['profile_access']) {
+  if ($variables['uid'] && ($variables['profile_access'] || $variables['uid'] === $user->id())) {
     // We are linking to a local user.
     $variables['attributes']['title'] = t('View user profile.');
     $variables['link_path'] = 'user/' . $variables['uid'];
-- 
2.4.5

