PDA

View Full Version : Show Thread Enhancements - Reduce font size on Long Username to fit Postbit (legacy)


jamoss
04-03-2015, 09:00 PM
I found that when I switched to the "legacy" postbit, some of the usernames wrapped (if they were particularly long:
http://www.townredmedia.com/images/mod1.png

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.

$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:

<vb:if condition="$memberinfo['musername']">{vb:raw memberinfo.musername}<vb:else />{vb:raw memberinfo.username}</vb:if>


and replace with:

<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:
http://www.townredmedia.com/images/mod4.png

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.

Fields
04-05-2015, 06:48 AM
Great mod, thanks for sharing! Works like a charm, 5 stars :)

friendlymela
08-03-2015, 03:18 AM
That is nice