Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Haven't got 6.x-dev checked out, so haven't provided a patch yet, but basically theme_username() in includes/theme.inc does this:
function theme_username($object) {
if ($object->uid && $object->name) {
// Shorten the name when it is too long or it will break many tables.
if (drupal_strlen($object->name) > 20) {
$name = drupal_substr($object->name, 0, 15) .'...';
}
else {
$name = $object->name;
}
if (user_access('access user profiles')) {
$output = l($name, 'user/'. $object->uid, array('attributes' => array('title' => t('View user profile.'))));
}
else {
$output = check_plain($name);
}
}
else if ($object->name) {
// Sometimes modules display content composed by people who are
// not registered members of the site (e.g. mailing list or news
// aggregator modules). This clause enables modules to display
// the true author of the content.
if (!empty($object->homepage)) {
$output = l($object->name, $object->homepage, array('attributes' => array('rel' => 'nofollow')));
}
else {
$output = check_plain($object->name);
}
$output .= ' ('. t('not verified') .')';
}
else {
$output = check_plain(variable_get('anonymous', t('Anonymous')));
}
return $output;
}
The whole chunk for non-registered member name display doesn't do the truncating of long usernames. I propose altering it like so:
function theme_username($object) {
// Shorten the name when it is too long or it will break many tables.
if (drupal_strlen($object->name) > 9) {
$name = drupal_substr($object->name, 0, 6) .'...';
}
else {
$name = $object->name;
}
if ($object->uid && $object->name) {
if (user_access('access user profiles')) {
$output = l($name, 'user/'. $object->uid, array('attributes' => array('title' => t('View user profile.'))));
}
else {
$output = check_plain($name);
}
}
else if ($object->name) {
// Sometimes modules display content composed by people who are
// not registered members of the site (e.g. mailing list or news
// aggregator modules). This clause enables modules to display
// the true author of the content.
if (!empty($object->homepage)) {
$output = l($name, $object->homepage, array('attributes' => array('rel' => 'nofollow')));
}
else {
$output = check_plain($name);
}
$output .= ' ('. t('not verified') .')';
}
else {
$output = check_plain(variable_get('anonymous', t('Anonymous')));
}
return $output;
}
Comments
Comment #1
buddaHow about substituting '...' for '…' (html entity & hellip;)?
Comment #2
greg.harveyNot a bad idea, while we're patchin'... =)