vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 4.x Add-ons (https://vborg.vbsupport.ru/forumdisplay.php?f=245)
-   -   Show Thread Enhancements - Reduce font size on Long Username to fit Postbit (legacy) (https://vborg.vbsupport.ru/showthread.php?t=318117)

jamoss 04-03-2015 09:00 PM

Reduce font size on Long Username to fit Postbit (legacy)
 
1 Attachment(s)
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.
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:
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


All times are GMT. The time now is 07:57 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01091 seconds
  • Memory Usage 1,713KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (3)bbcode_code_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (3)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete