Back to vBulletin 4.x Add-ons

Reduce font size on Long Username to fit Postbit (legacy)
Mod Version: 1.00, by jamoss

vB Version: 4.2.2 Rating: (1 vote - 5.00 average) Installs: 6
Released: 05 Apr 2015 Last Update: Never Downloads: 0
Not Supported Uses Plugins Template Edits Re-usable Code  

I found that when I switched to the "legacy" postbit, some of the usernames wrapped (if they were particularly long:


So I made a mod for this which contains 2 steps: a new plugin and template edit. Less than 5 minutes!

1. Create a plugin for hook location memberaction_dropdown. This puts the length of the username into a variable the template can use.
Code:
$memberinfo['unlength']= $memberinfo['musername']? strlen($memberinfo['musername']): strlen($memberinfo['username']);

2. Modify template memberaction_dropdown
Font size will be determined by you--what will fit in your postbit.

Find:
Code:
<vb:if condition="$memberinfo['musername']">{vb:raw memberinfo.musername}<vb:else />{vb:raw memberinfo.username}</vb:if>
and replace with:
Code:
<vb:if condition="$memberinfo['musername']">
    <vb:if condition="$memberinfo['unlength']>25"><span style="font-size:13pt;">{vb:raw memberinfo.musername}</span>
      <vb:else />{vb:raw memberinfo.musername}</vb:if>
<vb:else />
    <vb:if condition="$memberinfo['unlength']>15"><span style="font-size:13pt;">{vb:raw memberinfo.username}</span>
      <vb:else />{vb:raw memberinfo.username}</vb:if>
</vb:if>
Result:


Note: If the username has an html wrap ($memberinfo['musername']) I account for the html by adding 10 characters to the threshold. You'll have to play with this variable depending on your HTML wraps. HTML wraps are found in Usergroup Settings.

Download

No files for download.


vblts.ru supports vBulletin®, 2022-2024