Back to vBulletin 4.x Template Modifications

Personal User Badges
Mod Version: 1.00, by Jordan S Smith

vB Version: 4.2.1 Rating: (1 vote - 4.00 average) Installs: 11
Released: 30 Jul 2013 Last Update: Never Downloads: 0
Not Supported Template Edits Re-usable Code Translations  

This is something I came up with for a site I help manage. It gives users the option to set a custom badge that is displayed in the postbit_legacy. Sorry if I got the prefix wrong, I couldn't think which one this best belonged in.

Anyway, this is going to take advantage of template modification and profile field creation.

So, for starters, we're going to make the profile field that will be used for the badges. Open up your ACP and click on 'Add New User Profile Field'. Select 'Single-Line Text Box'. Title 'Personal User Badge'. Description can be whatever. Put it in the appropriate Profile Field Category.

Leave the default value blank. Make sure the field length is high, I use 100. That's for long image links. Set field length to 50. Don't mess with display order. Make sure field required is set to no. Field editable by user should be set to yes. Private field should be set to yes. This makes it so users can't see each others links. It makes the profile page look bad. Staff will still be able to see the links.

Field searchable on members list and show on members list should both be set to no. That's it, now click save. You should be redirected to the profile field manager.

When finished, it should look something like this when you click on edit:


Take note in the field manager of the 'name' column. This is important and will be needed later on. Find the 'name' for the newly created profile field.

Next your going to want to open your master style so this template edit will inherit. If it will not inherit you will have to add this manually to each individual style.

Find and open the template: postbit_legacy

Find this code:
Code:
<dl class="userinfo_extra">
You're going to want to place this before the closing tag:
Code:
<vb:if condition="$post['fieldxx']"><p style="text-align:center; margin-top:3px;"><img src="{vb:raw post.fieldxx}" alt="Badge" width="180" height="26"></p></vb:if>
So it will look like this:
Code:
<dl class="userinfo_extra">
    *stuff that's already here*
    <vb:if condition="$post['fieldxx']"><p style="text-align:center; margin-top:3px;"><img src="{vb:raw post.fieldxx}" alt="Badge" width="180" height="26"></p></vb:if>
</dl>
Now take the 'name' mentioned earlier. Replace the red text with that. Save your template and you're done!! Users can now add their own personal badges. Resolution is 180x26 by default. If you'd like to change that simply edit the green portions of the code.

If this receives enough attention I'll update with the personal links option. This allows users to set a link for their badges so that when users click on the image they'll be redirected.

EDIT: http://www.kh-flare.net/showthread.php/789-Last-Person-to-Post?p=11977#post11977

I've directed you to a post by me. As you can see there are two badges. I used this feature to make one for staff only. That's how it will appear though.

EDIT2: Here's a screen capture of what it would look like for those of you who don't or can't view the demo site.

Download

No files for download.

Screenshots

Click image for larger version
Name:	Capture.PNG
Views:	991
Size:	136.7 KB
ID:	145968  


vblts.ru supports vBulletin®, 2022-2024