Index: realname_theme.inc =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/realname/realname_theme.inc,v retrieving revision 1.2.4.1 diff -u -r1.2.4.1 realname_theme.inc --- realname_theme.inc 8 Jun 2008 16:25:04 -0000 1.2.4.1 +++ realname_theme.inc 9 Jun 2008 16:00:06 -0000 @@ -18,14 +18,22 @@ * suggests that this is a site user. Otherwise, only the username is returned. */ function phptemplate_username($object) { + + // If the user has a nickname defined and wants to use that + $user = user_load(array(uid => $object->uid)); + if ($user->profile_show_nickname && !empty($user->profile_nickname)) { + $object->realname = $user->profile_nickname; + } + else { // If we have a user id but no realname, then make one. - if ($object->uid && !$object->realname) { - $account = user_load(array('uid' => $object->uid)); - $object->realname = realname_make_name($object); + if ($object->uid && !$object->realname) { + $account = user_load(array('uid' => $object->uid)); + $object->realname = realname_make_name($object); + } } + // Shorten the name when it is too long or it will break many tables. if ($object->uid && $object->realname) { - // Shorten the name when it is too long or it will break many tables. if (drupal_strlen($object->realname) > 25) { $name = drupal_substr($object->realname, 0, 20) .'...'; }