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.
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.
Comment | File | Size | Author |
---|---|---|---|
#2 | common_1.diff | 544 bytes | ñull |
common_0.diff | 546 bytes | ñull | |
Comments
Comment #1
Uwe Hermann CreditAttribution: Uwe Hermann commentedComment #2
ñull CreditAttribution: ñull commentedI 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.
Comment #3
Bèr Kessels CreditAttribution: Bèr Kessels commentedIMO this should be done in a theme, not with yet another config option.
what about theme_username() ?
Comment #4
killes@www.drop.org CreditAttribution: killes@www.drop.org commentedtheme_username++
format_name is one of the functions I always need to modify. theme_date would be nice, too.
Comment #5
Dries CreditAttribution: Dries commentedThis should be done in the theme.
Comment #6
tangent CreditAttribution: tangent commentedIn some cases there may not be a need to truncate the output at all. We should consider using CSS to adjust the display of text rather than truncating strings to arbitrary lengths that may be less than can be viewed in a given resolution.
Given the following markup
the following CSS may be used to control the overflow of the container.
Use of the proprietary (MS Internet Explorer) "text-overflow" property may be used to show ellipsis on a container with hidden content. Javascript could be used to display ellipsis on these containers for other browsers as well, though it may well not be worth doing so.
Using CSS to control display in this manner gives greater control for supporting variable environments (graphical browser, wap browser, text browser) without limiting the content that I user needs to see.
Comment #7
ñull CreditAttribution: ñull commentedAccording to that reasoning, the username crop should be taken out of the code, because the problem can be solved through CSS. Whatever the way to solve this problem, it should be configurable by the user. At the moment the code decides it for me and I cannot show the letters with CSS were code cropped it away for me.
Comment #8
killes@www.drop.org CreditAttribution: killes@www.drop.org commentedThis issue should be fixed by makinf format_name themable. Marking active.
Comment #9
ñull CreditAttribution: ñull commentedComment #10
ñull CreditAttribution: ñull commentedComment #11
adrian CreditAttribution: adrian commentedwe now have theme_username