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 |
#62
|
||||
|
||||
You need to use the <a> tag for links - http://www.w3schools.com/tags/tag_a.asp and please use double-quotes in the tag, not single-quotes since the single-quotes are being used in the equation.
|
#63
|
|||
|
|||
i am just very new to all this so i have no idea how to do it ...
isn't there a way you can put a form in the pluginconfiguration where the plugin-user could type in or choose the fieldID ? but well if needed i will probably finishing my community first and after i went live i can look into this again ... still having headaches over other things in VBB ... have to learn alot |
#64
|
||||
|
||||
I already have it in a form where all you have to do is change the field id. This is an article, not a modification. If you don't know how to do it, then I suggest you try it out on your test site.
|
#65
|
|||
|
|||
okay thank you very much
it all looks very complicated if you are new to vbulletin ... but after some time it gets more simple ... nice work you done here |
#66
|
||||
|
||||
I'm sorry if this is inappropriate to ask here, but reading through this guide it looks like the same method could be used to put custom profile fields into the user's signature. Which templates would I need to edit to force a custom field to always be displayed in a user's signature?
EDIT: Nevermind, please disregard. I found what I needed in the postbit_legacy template! Thank you! |
#67
|
||||
|
||||
Quote:
Join Date: Posts: Character Profile Even if its the whole Character Profile is the hyperlink that will take member directly to the character profile will work. I believe you said that I would have to use the <a> tag, but I'm not sure how to insert it into the code you already have. |
#68
|
||||
|
||||
Something like:
PHP Code:
|
#69
|
||||
|
||||
That didn't work, I got this error at the top of my board. I tried just doing the regular method two you have posted, but the profile field didn't show up under the post count either.
|
#70
|
||||
|
||||
And what was the error? And what was the *exact* code you entered into the plugin?
|
#71
|
||||
|
||||
Sorry, I tried it again and it worked perfectly. I must have not posted something right. I got the error because I left out the:
if ($post['fieldx']) { I thought I added it when I tried a second time, but I didn't get an error message nor did anything show up. But here's the completed code for Method 2 that works perfectly: Code:
if ($post['fieldx']) { $template_hook['postbit_userinfo_right_after_posts'] .= '<dt>My fieldX</dt> <dd><a href="' .$post[fieldx]. '">My Link</a></dd>'; } I also adjusted the code so that it fits Method 1 and I tested it and it works great to. It still goes in the same place you said. Code:
<vb:if condition="$post['fieldx']"><dt>My fieldX</dt> <dd><a href="{vb:raw post.fieldx}">My Link</a></dd></vb:if> |
Thread Tools | |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|