[drupal-devel] [feature] Adjustable username crop

Dries drupal-devel at drupal.org
Thu Jan 27 21:27:15 UTC 2005

 Project:      Drupal
 Version:      4.5.2
 Component:    node system
 Category:     feature requests
 Priority:     normal
 Assigned to:  com2
 Reported by:  com2
 Updated by:   Dries
 Status:       patch

This should be done in the theme.


Previous comments:

January 27, 2005 - 18:11 : com2

Attachment: http://drupal.org/files/issues/common_0.diff (546 bytes)

Some people might not like it when long usernames are cropped in the
node haeder. This patch can be applied to includes/common.inc version
4.5.2 and creates a new variable 'user_name_crop' to adjust the crop


January 27, 2005 - 22:32 : com2

Attachment: http://drupal.org/files/issues/common_1.diff (544 bytes)

I had the numbers wrong. In the original code it was cropped at 15, not
at 10 like in my diff. I also changed it a bit to avoid negative
argaments. Attached the new diff from version 4.5.2. 

   if ($object->uid && $object->name) {
     // Shorten the name when it is too long or it will break many
    if (strlen($object->name) > variable_get('user_name_crop', 15)+5)
      $name = truncate_utf8($object->name,
variable_get('user_name_crop', 15)) .'...';
     else {
       $name = $object->name;


January 27, 2005 - 23:00 : Bèr Kessels

IMO this should be done in a theme, not with yet another config option.
what about theme_username() ?


January 27, 2005 - 23:07 : killes at www.drop.org

format_name is one of the functions I always need to modify. theme_date
would be nice, too.

View: http://drupal.org/node/16299
Edit: http://drupal.org/project/comments/add/16299

More information about the drupal-devel mailing list