Index: includes/theme.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/theme.inc,v retrieving revision 1.523 diff -u -r1.523 theme.inc --- includes/theme.inc 11 Sep 2009 15:17:00 -0000 1.523 +++ includes/theme.inc 12 Sep 2009 15:28:49 -0000 @@ -1948,17 +1948,29 @@ * @see template_process_username() */ function theme_username($object) { - if (isset($object->link_path)) { - // We have a link path, so we should generate a link using l(). - // Additional classes may be added as array elements like - // $object->link_options['attributes']['class'][] = 'myclass'; - $output = l($object->name . $object->extra, $object->link_path, $object->link_options); + if (empty($object->uid)) { + $output = check_plain(variable_get('anonymous', t('Anonymous'))); } else { - // Modules may have added important attributes so they must be included - // in the output. Additional classes may be added as array elements like - // $object->attributes['class'][] = 'myclass'; - $output = 'attributes) . '>' . $object->name . $object->extra . ''; + $name = $object->name; + if (isset($object->extra)) { + $name .= $object->extra; + } + if (isset($object->link_path)) { + // We have a link path, so we should generate a link using l(). + // Additional classes may be added as array elements like + // $object->link_options['attributes']['class'][] = 'myclass'; + $output = l($name, $object->link_path, $object->link_options); + } + elseif (isset($object->attributes)) { + // Modules may have added important attributes so they must be included + // in the output. Additional classes may be added as array elements like + // $object->attributes['class'][] = 'myclass'; + $output = 'attributes) . '>' . $name . ''; + } + else { + $output = $name; + } } return $output; }