[drupal-devel] [feature] Adjustable username crop

killes drupal-devel at drupal.org
Thu Jan 27 21:07:43 UTC 2005


 Project:      Drupal
 Version:      4.5.2
 Component:    node system
 Category:     feature requests
 Priority:     normal
 Assigned to:  com2
 Reported by:  com2
 Updated by:   killes at www.drop.org
 Status:       patch

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

killes at www.drop.org



Previous comments:
------------------------------------------------------------------------

January 27, 2005 - 17: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
length. 

------------------------------------------------------------------------

January 27, 2005 - 21: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
tables.
    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 - 22:00 : Bèr Kessels

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

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





More information about the drupal-devel mailing list