MimeSong Erk
04-25-2006, 10:00 PM
I hate big signatures. I hate them with a passion: I use a laptop for half of my forumwork, and it's an old beasty with an 800x600 resolution cap. Big signatures turn a simple thread into a massive scrollfest. Therefore, I put signature size limits on my forum... just a simple overflow pane on the signature that forced scrollbars onto sigs over the size limit of 150x550 pixels. It worked well enough, but users were complaining that 1) it messed with sig centering, as they center inside the 550px division instead of the entire postbit, and 2) some lazy scrollwheel users got caught inside the vertical scrollbar and it made their scrolling jerky (aww, muffin).
I was initially going to just ignore the complaints because I know I am always right, but then someone pointed out I could just make the sig size limit end-user defined. It took a bit of work, but here it is... my first real vBulletin plugin that isn't a complete and utter bit of hack-work.
ADMIN NOTES:
This allows users to specify how large they want signatures to display as on their page. Any larger than the specified values, and the signature will get scrollbars to contain it. If the users leave the signatures size limit fields blank, then to them signatures will appear totally normal, as if this plugin hadn't been added. Whatever the user has his settings at will not affect the way other users view his or other signatures.
STEP ONE:
Set up two custom user fields (single-line text entry) called something like "Sig Height Limit" and "Sig Width Limit". Set them to private and unsearchable, and give them descriptions for the users. Here is my description for "Signature Horizontal Limit" on my forum:Signature horizontal limit:
The maximum number of pixels you want signatures to display as before scrollbars are added. Enter as [number]px, eg 580px. Leave blank to allow unrestricted signature sizes.Please note, for me the width limit field is field15 and the height limit field is field16. Your field names will probably be different, so take note of what they are and replace "field15" and "field16" with the appropriate values.
STEP TWO:
I work only in Legacy format, so if you use the new-fangled postbit this might be a bit different. Anyway, in postbit_legacy look for:
<if condition="$post['signature']">
<!-- sig -->
<div>
__________________<br />
$post[signature]
</div>
<!-- / sig -->
</if>
Replace that with this:
<!-- sig -->
<if condition="$post['signature'] AND $bbuserinfo[field16] AND $bbuserinfo[field15]">
<div>
__________________
<div style="overflow: auto; height: $bbuserinfo[field16]; width: &bbuserinfo[field15]">$post[signature]</div>
</div>
<else />
<if condition="$post['signature'] AND $bbuserinfo[field16]">
<div>
__________________
<div style="overflow: auto; height: $bbuserinfo[field16]">$post[signature]</div>
</div>
<else />
<if condition="$post['signature'] AND $bbuserinfo[field15]">
<div>
__________________
<div style="overflow: auto; width: $bbuserinfo[field15]">$post[signature]</div>
</div>
<else />
<if condition="$post['signature']">
<div>
__________________
<div>$post[signature]</div>
</div>
</if>
</if>
</if>
</if>
<!-- / sig -->
Voila. If your users leave their sig restriction values blank, their vB will appear as if you'd changed nothing. If they put in restrictions, they could limit other users' sigs to appearing as any size they like.
A quick hack I suggested to members of my forum:
OPTIONAL: Non-IE users can take advantage of a simple "cheat code" to get smoother signature restrictions. If you use FireFox, Mozilla, or anything but IE, try entering the following into the signature height field:
150px; max-width: 550px;
the first number (150px) is the height variable, the second the width variable. Leave the "signature horizontal limit" option totally blank. This won't screw anything up in IE, it simply won't do anything at all. The effect is very similar to setting a max width using the Horizontal Limit option, but it won't force your page to stretch to the width you've specified, if your window is smaller than the max-width.
STEP THREE:
Simply notify your users where to find the sig restriction settings, and remind them to include the "px" after the value they enter (although if you wanted to code this out you easily could. I wanted to leave my technically-inclined users the option to enter %, *, or other values there should they choose).
This system has been tested in FireFox, IE, and Netscape. Please post any problems with it; I am an artist, not a programmer, so I have no idea if I've made any dire mistakes.
UNINSTALLING:
To uninstall, simple revert the changed code back to vBulletin default, and delete your custom user groups. A txt file is attached that includes the changed code; just store it in your records if you don't care to try to find this topic again.
I was initially going to just ignore the complaints because I know I am always right, but then someone pointed out I could just make the sig size limit end-user defined. It took a bit of work, but here it is... my first real vBulletin plugin that isn't a complete and utter bit of hack-work.
ADMIN NOTES:
This allows users to specify how large they want signatures to display as on their page. Any larger than the specified values, and the signature will get scrollbars to contain it. If the users leave the signatures size limit fields blank, then to them signatures will appear totally normal, as if this plugin hadn't been added. Whatever the user has his settings at will not affect the way other users view his or other signatures.
STEP ONE:
Set up two custom user fields (single-line text entry) called something like "Sig Height Limit" and "Sig Width Limit". Set them to private and unsearchable, and give them descriptions for the users. Here is my description for "Signature Horizontal Limit" on my forum:Signature horizontal limit:
The maximum number of pixels you want signatures to display as before scrollbars are added. Enter as [number]px, eg 580px. Leave blank to allow unrestricted signature sizes.Please note, for me the width limit field is field15 and the height limit field is field16. Your field names will probably be different, so take note of what they are and replace "field15" and "field16" with the appropriate values.
STEP TWO:
I work only in Legacy format, so if you use the new-fangled postbit this might be a bit different. Anyway, in postbit_legacy look for:
<if condition="$post['signature']">
<!-- sig -->
<div>
__________________<br />
$post[signature]
</div>
<!-- / sig -->
</if>
Replace that with this:
<!-- sig -->
<if condition="$post['signature'] AND $bbuserinfo[field16] AND $bbuserinfo[field15]">
<div>
__________________
<div style="overflow: auto; height: $bbuserinfo[field16]; width: &bbuserinfo[field15]">$post[signature]</div>
</div>
<else />
<if condition="$post['signature'] AND $bbuserinfo[field16]">
<div>
__________________
<div style="overflow: auto; height: $bbuserinfo[field16]">$post[signature]</div>
</div>
<else />
<if condition="$post['signature'] AND $bbuserinfo[field15]">
<div>
__________________
<div style="overflow: auto; width: $bbuserinfo[field15]">$post[signature]</div>
</div>
<else />
<if condition="$post['signature']">
<div>
__________________
<div>$post[signature]</div>
</div>
</if>
</if>
</if>
</if>
<!-- / sig -->
Voila. If your users leave their sig restriction values blank, their vB will appear as if you'd changed nothing. If they put in restrictions, they could limit other users' sigs to appearing as any size they like.
A quick hack I suggested to members of my forum:
OPTIONAL: Non-IE users can take advantage of a simple "cheat code" to get smoother signature restrictions. If you use FireFox, Mozilla, or anything but IE, try entering the following into the signature height field:
150px; max-width: 550px;
the first number (150px) is the height variable, the second the width variable. Leave the "signature horizontal limit" option totally blank. This won't screw anything up in IE, it simply won't do anything at all. The effect is very similar to setting a max width using the Horizontal Limit option, but it won't force your page to stretch to the width you've specified, if your window is smaller than the max-width.
STEP THREE:
Simply notify your users where to find the sig restriction settings, and remind them to include the "px" after the value they enter (although if you wanted to code this out you easily could. I wanted to leave my technically-inclined users the option to enter %, *, or other values there should they choose).
This system has been tested in FireFox, IE, and Netscape. Please post any problems with it; I am an artist, not a programmer, so I have no idea if I've made any dire mistakes.
UNINSTALLING:
To uninstall, simple revert the changed code back to vBulletin default, and delete your custom user groups. A txt file is attached that includes the changed code; just store it in your records if you don't care to try to find this topic again.