Hi,

Realname is slow in the following case:

- Add a Realname: Name field to the view and set it to "Link to this users profile" (500 ms)

Without this Link the performance is: 80ms.

The reason is that the "realname" field of the account object is not populated in the views handler and such the database has to be queried again for each user displayed.

With 100 records it gets worth and reaches 2 sec of display calculation.

Easy fix:


--- realname/realname_handler_field_user_name.inc
+++ realname/realname_handler_field_user_name.inc
@@ -27,6 +27,7 @@ class realname_handler_field_user_name extends views_handler_field_user_name {
}
elseif (!empty($this->options['link_to_user'])) {
$account->name = $values->{$this->field_alias};
+ $account->realname = $values->{$this->aliases['realname']};
return theme('username', $account);
}
}

Please apply.

Best Wishes,

Fabian (LionsAd)

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Fabianx’s picture

Here is the code again:

diff --git a/sites/all/modules/realname/realname_handler_field_user_name.inc b/sites/all/modules/login/realname/realname_handler_field_user_name.inc
index c61b0e3..56bb210 100644
--- a/sites/all/modules/realname/realname_handler_field_user_name.inc
+++ b/sites/all/modules/realname/realname_handler_field_user_name.inc
@@ -27,6 +27,7 @@ class realname_handler_field_user_name extends views_handler_field_user_name {
       }
       elseif (!empty($this->options['link_to_user'])) {
         $account->name = $values->{$this->field_alias};
+        $account->realname = $values->{$this->aliases['realname']};
         return theme('username', $account);
       }
     }
joelpittet’s picture

Issue summary: View changes
FileSize
2.15 KB

Here's that as a patch, thanks @Fabianx

There is a bit of whitespace cleanup from my editor... hopefully that is ok and I applied the change to both handlers before the theme() call.

hass’s picture

Status: Needs review » Closed (won't fix)

Please upgrade to D7/D8 or reopen if not a D6 issue only.