Support Forum

Advanced Search
Forum Scope


Match



Forum Options



Minimum search word length is 3 characters - maximum search word length is 84 characters
themes-topic
Forum and Topic View -Truncating very long usernames
Avatar
Conrad_Farlow
Sheffield, UK
Member
Free Members
sp_UserOfflineSmall Offline
Mar 29, 2012 - 7:56 pm

I am probably being really silly here and the fact is that most users are unlikely to have a problem but how can I truncate or limit a username in Forum and Topic Views?

For instance

sp_PostIndexUserName('tagClass=spPostUserName spCenter&truncate=50');

Does not work.

It is possible to have really long usernames such as hyphenated names that really mess up the appearance of both Topic and Forum View. We insist on real names for our forums and there are a couple of names that will cause problems with this.

Can it be fixed?

Conrad

Avatar
Brandon
U.S.
SP Wrangler
Free Members
sp_UserOfflineSmall Offline
Mar 29, 2012 - 9:53 pm

There isn't an argument available like that for truncating a user name like there is for a topic name.

I can see how this could cause you some formatting issues in several places depending on your layout.
Maybe the spTruncate function could be used to globally truncate a username instead of having to do so on every line that shows a user name.

I am sure Steve or Andy will pipe in with ideas.

Avatar
Mr Papa
Simi Valley, CA
SP Master
Free Members
sp_UserOfflineSmall Offline
Mar 30, 2012 - 9:09 pm

No afraid not... that might look quite odd... but we can consider it...

there is an sp function you can use on the returned value:  sp_truncate($name, $length)

and try to truncate it yourself... be careful, if you have it set to be a link though, the html will consume characters...

Avatar
Conrad_Farlow
Sheffield, UK
Member
Free Members
sp_UserOfflineSmall Offline
Apr 2, 2012 - 6:11 am

I see that you have raised a ticket for this and it has been closed for incorporation into SP 5.05. When will that be released do you think?

Thanks as ever.

Conrad

Avatar
Yellow Swordfish
Glinton, England
SP Master
sp_UserOfflineSmall Offline
Apr 2, 2012 - 10:25 am

we are tentatively thinking next weekend at the moment. Depends if anything big crops up between then and now.

andy-signature.png
YELLOW
SWORDFISH
Avatar
Conrad_Farlow
Sheffield, UK
Member
Free Members
sp_UserOfflineSmall Offline
Apr 8, 2012 - 6:19 pm

I have upgraded so how do I implement the truncate user names feature?

Avatar
Brandon
U.S.
SP Wrangler
Free Members
sp_UserOfflineSmall Offline
Apr 8, 2012 - 7:35 pm

You would use truncateUser in each view file and set the length.

For example in GroupView.php to truncate to 5 for last post.

sp_ForumIndexLastPost('tagClass=spInRowPostLink&nicedate=1&date=0&time=0&stackdate=0&truncateUser=5', __sp('Last Post'), __sp('No Topics'));
Avatar
Mr Papa
Simi Valley, CA
SP Master
Free Members
sp_UserOfflineSmall Offline
Apr 8, 2012 - 8:43 pm

like the other truncation, but for users...  valid for:  sp_SubForumIndexLastPost, sp_TopicIndexFirstPost, sp_TopicIndexLastPost, sp_ForumIndexLastPost, sp_ListLastPost and sp_PostIndexUserName

Avatar
Conrad_Farlow
Sheffield, UK
Member
Free Members
sp_UserOfflineSmall Offline
Apr 8, 2012 - 8:44 pm

Yup implemented and working fine thanks.

Avatar
Mr Papa
Simi Valley, CA
SP Master
Free Members
sp_UserOfflineSmall Offline
Apr 8, 2012 - 8:55 pm

cool. thanks for the confirmation and update...

Forum Timezone: Europe/Stockholm
Most Users Ever Online: 1170
Currently Online:
Guest(s) 1
Currently Browsing this Page:
1 Guest(s)
Top Posters:
Mr Papa: 19448
Ike: 2086
Brandon: 864
kvr28: 804
jim: 650
FidoSysop: 577
Conrad_Farlow: 531
fiddlerman: 358
Stefano Prete: 325
Member Stats:
Guest Posters: 619
Members: 17361
Moderators: 0
Admins: 4
Forum Stats:
Groups: 7
Forums: 17
Topics: 10127
Posts: 79625