• Downloading from our site will require you to have a paid membership. Upgrade to a Premium Membership from 10$ a month today!

    Dont forget read our Rules! Also anyone caught Sharing this content will be banned. By using this site you are agreeing to our rules so read them. Saying I did not know is simply not an excuse! You have been warned.

[vB5] User Profile Fields in the postbit templates

Admin

Well-Known Member
Staff member
Administrator
Using your User Profile Fields on your site

This article is written with the assumption that you have already created your own User Profile Fields in the User Profile Field Manager. If you need help with this, you may read about it in the manual here - http://www.vbulletin.com/docs/html/profile

For the Purposes of this article, I will be referring to "fieldx" as the name of your profile field. Your real name will be found in the User Profile Manager in the "Name" column - field1, field2, etc.


First thing to do is figure out which fields you want to add to your postbit. Go to your Admincp > User Profile Fields > User Profile Field Manager and note both the Field Name (field1, field2, etc) and the Category the field is in (see image 1). The Profile Fields are listed under their Category Title on this page. It should either be "(Uncategorized)" or have some other category listed. To then get the Category ID, go to User Profile Field Categories, click to Edit the category you want the ID of, and it will be listed at the top - id x (see image 2). Uncategorized Categories have no Category ID.

Image 1:
attachment.php


Image 2:
attachment.php

So, now that you have a list of field ids and category ids, you can now easily add them to your postbit.

First make sure your hook system is active (it is turned off by default). Go to Admincp > Settings > Products/Hook System > Enable/Disable Hook System > Yes.

Now, go to Admincp > Products & Hooks > Manage Hooks and click the link that says "[Add New Hook]". In that new hook, set the following:

Hook is Active: Yes
Hook Location: conversation_userstats
Title: Show Profile Fields in Postbit
Template Name: conversation_fields
Hook Arguments: conversation=conversation
SAVE
Now go to Admincp > Styles & Templates > Style Manager > Add New Template and on that page, set the following:

Title: conversation_fields
Template:
Code:
{vb:data userInfo, user, fetchProfileInfo, {vb:raw conversation.userid}}

For each field you want shown, you will need to add this code under that line:
Code:
<vb:if condition="$userInfo['fieldX']"><li><label>{vb:phrase fieldX_title}:</label> <span>{vb:raw userInfo.customFields.default.fieldX_title.val}</span></li></vb:if>

Replace the X in "FieldX" (three times) with the fieldid and, if your field is in a Category other than Uncategoried, then replace "default" with "categoryY_title" where Y is the category id.

So, for instance, say I have the following I want to add:
Name Category
field5 (uncategoried)
field7 New Cat(id 1)​

Then my template would look like this:
Code:
{vb:data userInfo, user, fetchProfileInfo, {vb:raw conversation.userid}}

<vb:if condition="$userInfo['field5']"><li><label>{vb:phrase field5_title}:</label> <span>{vb:raw userInfo.customFields.default.field5_title.val}</span></li></vb:if>

<vb:if condition="$userInfo['field7']"><li><label>{vb:phrase field7_title}:</label> <span>{vb:raw userInfo.customFields.category1_title.field7_title.val}</span}</li></vb:if>

That's it!
 

Facebook Comments

Similar threads
Thread starter Title Forum Replies Date
Admin Yilmaz - User Profile Menu vB5 Add-ons 0
Admin Yilmaz - My Story vB5 Add-ons 0
Admin Yilmaz - Particles vB5 Add-ons 0
Admin Yilmaz - Avatars Slider vB5 Add-ons 0
Admin Yilmaz - GIPHY Button vB5 Add-ons 0
Admin Yilmaz - Ad in Left or Right Side vB5 Add-ons 0
Admin Yilmaz - Hide Content From Guests vB5 Add-ons 0
Admin Yilmaz - Crawler Film Strip vB5 Add-ons 0
Admin Yilmaz - Follow us on vB5 Add-ons 0
Admin Yilmaz - Latest videos on your Youtube channel vB5 Add-ons 0
Admin Yilmaz - Force Users to Read a Thread vB5 Add-ons 0
Admin Yilmaz - Username HTML Markup vB5 Add-ons 0
Admin Yilmaz - Radio Player vB5 Add-ons 0
Admin Yilmaz - Live, Who Where? vB5 Add-ons 0
Admin Yilmaz - Image upload mod for vB5 Add-ons 0
Admin Yilmaz - Post New Thread Button To Showthread vB5 Add-ons 0
Admin Yilmaz - Force Guests to Register vB5 Add-ons 0
Admin Yilmaz - Thread Author vB5 Add-ons 0
Admin Yilmaz - Footer Layout vB5 Add-ons 0
Admin Yilmaz - Portal Modules vB5 Add-ons 0
Admin [CJ] Staff online widget vB5 Add-ons 0
Admin Yilmaz - Blinking Text BBcode vB5 Add-ons 0
Admin Yilmaz - Current Staff Online Module VB5 Add-ons 0
Admin Yilmaz - Login or Sign Up Module VB5 Add-ons 0
Admin Yilmaz - Xmas Footer vB5 Add-ons 0
Admin Yilmaz - Canvas Snow Effect vB5 Add-ons 0
Admin Yilmaz - Similar Threads vB5 Add-ons 0
Admin Yilmaz - PDF Viewer vB5 Add-ons 0
Admin Yilmaz - X Viewing Channel Information Module vB5 Add-ons 0
Admin Yilmaz - X Viewing Thread Information Module vB5 Add-ons 0
Admin Yilmaz - Channel Description Per Forum Page vB5 Add-ons 0
Admin Yilmaz - X Viewing Channel vB5 (Main Product) Add-ons 1
Admin Yilmaz - Meta Description in Header vB5 Add-ons 0
Admin Yilmaz - HashTags vB5 Module Add-ons 0
Admin Yilmaz - Plus Number of Fake Active Members vB5 Add-ons 0
Admin Yilmaz - Auto Video Embed vB5 Add-ons 0
Admin Yilmaz - COVERED PROFILE Module vB5 Add-ons 0
Admin Yilmaz - Hotbar Module vB5 Add-ons 0
Admin Yilmaz - Slide Show vB5 Add-ons 0
Admin Yilmaz - Horizontal Postbit vB5 Add-ons 0
Admin Yilmaz - Cover Header vB5 v2 Add-ons 0
Admin [CJ] Randomize vB5 Add-ons 0
Admin Yilmaz - Random Images in Header vB5 Add-ons 0
Admin Yilmaz - Quote Expander / Collapse vB5 Add-ons 0
Admin Yilmaz - Recent Visitors of the Profiles (vb5.6.x widget) Add-ons 0
Admin Yilmaz - Hide [code,php,html] content from guests (vb5.6.x) Add-ons 0
Admin vB5 Invite-only Add-ons 0
Admin BlackOrange for vb5.0.2 from sultantheme Add-ons 0
Admin Post Quote Length Limit (vB5) Vbb tutorial 0
Admin vBSocial.com Social Network -v.9.2 vB5 Mods (Ajax) Add-ons 0

Similar threads

New posts New threads New resources

Back
Top