The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
Using your User Profile Fields in your postbit templates (w/ all plugin method)
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. Adding the Profile Field to your postbit (or postbit_legacy) template For Single-Line Text Box, Multiple-Line Text Box, Single-Selection Radio Buttons, and Single-Selection Menu Method 1 - Modifying the Template Open the postbit or postbit_legacy template and find the area you want to add it to. For instance, to add it right after the user post count, find this:Method 2 - Using a template_hook I have always found it easier to just use the existing $template_hooks in the template and write a plugin to add these. In this case, there is a $template_hook right where we want it, after the user post count:For Multiple-Selection Menu and Multiple-Selection Checkbox It is a bit more complicated for these two types of selections since the options selected are stored as a binary number. If you just display the field using the method above, you will get a number, not a list of options selected. So, in order to use these types of fields, you will have to use the method below. Here is a thead that will explain the binary scheme - http://www.vbulletin.com/forum/showt...To-The-Postbit Method 1 - Modifying the Template Open the template and find the area you want to add it to. For instance, to add it right after the user post count, find this:Method 2 - Using a template_hook Find the template_hook you want to use. In this case, there is a $template_hook right where we want it, after the user post count:More Advanced If you like everything to be 'automatic' - meaning you don't have to supply any text at all, just use everything already stored in the database - then you can use a few of plugins to do the work for you. Plugin 1 - This plugin is used to get the phrasegroup "cprofilefield" added for use in the page so that you may use $vbphrase[fieldx_title] to get the Profile Field Title you entered in the User Profile Field Manager. ? hook location - init_startupPlugin 2 - This plugin is used to get the fields you defined for the profile in the User Profile Field Manager. ? hook location - showthread_postbit_createPlugin 3 - This plugin simply spits the data out into the postbit using the template_hook and using the phrase for the Title and the Options are all spit out with commas between them (if needed) into the postbit. ? hook location - postbit_display_complete |
#42
|
|||
|
|||
Hi guys,
just have a question regarding to display a phrase in my profile field Let's say i created field9 -> and a language dependend title in field9_title. Now I edited the postbitlegacy template: Code:
<vb:if condition="$post[field9]"> <dt>{vb:rawphrase field9_title}</dt> <dd>{vb:raw post.field9}</dd> </vb:if> But why is vb:rawphrase not working with field9_title? And what can I do to get it working? And why is vbphrase not working? Thanks! |
#43
|
||||
|
||||
You need to create a plugin to add that phrasegroup to the page. The plugin is shown in the first post.
(Sorry, I'm stuck on dialup right now and not going to go look it up and post it again.) |
#44
|
|||
|
|||
This is great and just what I was looking for, thanks.
One question though, how do I add commas for the multi-selection fields? I used method 1 and have this code, which works: Code:
<vb:if condition="$post['field5']"><dt>Spil</dt><dd> <vb:if condition="$post['field5'] & 1">Ingen</vb:if> <vb:if condition="$post['field5'] & 2">WoW</vb:if> <vb:if condition="$post['field5'] & 4">SWTOR</vb:if> <vb:if condition="$post['field5'] & 8">Rift</vb:if> <vb:if condition="$post['field5'] & 16">Andet</dd> </vb:if> Any help much appreciated! |
#45
|
||||
|
||||
works great but is there a reason if you see in the second post it doesnt show the label for the fields after making a post until I refresh the page. Also announcements never show the labels.
I went with the more advanced method of inserting this stuff |
#46
|
||||
|
||||
A nice tutorial Lynne, thanks.
|
#47
|
|||
|
|||
Thank you thank you thank you! 5 stars!
|
#48
|
|||
|
|||
Great work
Thanks |
#49
|
|||
|
|||
I'm struggeling to get my new profilefield right under the username. I've read the previous post about it, but still can't figure out where to your code <vb:if condition="$post['fieldx']"><dt>My FieldX</dt> <dd>{vb:raw post.fieldx}</dd></vb:if>.
Is it in postbit or postbit legacy? And exactly where do I put it? I've tried several places, with no succes. Thanks a million. |
#50
|
||||
|
||||
Do you have your userinfo on top of the post (postbit) or on the left side of the post (postbit_legacy)? That determines which template to edit.
|
#51
|
||||
|
||||
There's a way to use profile fields also in other pages like cms articles?
|
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|