PDA

View Full Version : strlen usernames in postbit


TheMilkCarton
11 Jul 2007, 21:57
I simply want to prevent usernames from wrapping to a new line by cutting off long usernames and add "...". This is a default feature in IPB to my knowledge, so I'm not sure why it hasn't been done in vBulletin.

I know the basic strlen code to use, but I'm stumped with what hook to use and what additional code I'd need in the plugin (like queries, etc.).

Dismounted? Anyone? :)

Dismounted
12 Jul 2007, 07:08
Hook: postbit_display_complete


Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------

TheMilkCarton
12 Jul 2007, 15:12
Well that's basically what I had... but still no dice.

Ah..... I'm guessing I need to use $post['musername'] or something instead? This doesn't shorten the big username, but it does shorten the username in the dropdown menu when you click on the big username.
---------------------------------
OK..... It doesn't work exactly the way I need it to.. It currently takes any Username HTML markup into account so here's what happens:



Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------



This was when I tested the # of characters at 10 instead of 25.

Dismounted
13 Jul 2007, 07:09
Try:


Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------

TheMilkCarton
13 Jul 2007, 17:01
Nope, that's still replacing the wrong instance of the username in the postbit.

That replaces the username in the thead of the dropdown when you click on the Big Username.

If I replace all $post['username'] instances with $post['musername'] it still goes completely screwy.

Example:

Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------

and it wraps

Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------

around EVERYthing in the postbit.