Home ›
Undo Drupal's over-aggressive shortening of user namesUndo Drupal's over-aggressive shortening of user names
And use a real ellipses!
Drupal's theme_username() is used many places within Drupal, and shortens any name over 20 characters, which can be a lot if you encourage people to use full names. This can be undone with a preprocess function in your module or theme, just replace EXAMPLE with your module or theme name.
<?php
/**
* Undo template_preprocess_username()'s aggressive shortening of names.
*/
function EXAMPLE_preprocess_username(&$variables) {
$name = check_plain($variables['name_raw']);
if (drupal_strlen($name) > 35) {
$name = drupal_substr($name, 0, 35) . '…';
}
$variables['name'] = $name;
}
?>
Comments
Post new comment