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 |
#52
|
||||
|
||||
I'm sure there is, but this article is not about that, it is about using them in the postbit template.
|
#53
|
|||
|
|||
I've set this up using the advanced method but when it displays I only get the binary number and not the array of choices selected... what am I doing wrong?
|
#54
|
||||
|
||||
I don't know. How about a screen shot of your admincp profile field set up and the exact code/hook for your plugin.
|
#55
|
|||
|
|||
I actually altered this into another mod - Profile Intro. The mod adds a memberprofile header that displays custom profile fields defined from the usercp. The mod itself displays input and textarea fields fine, but when it comes to multi_select fields they only display the binary code. I searched through and found this article and attempted to alter it into the Profile Intro mod, the basic function that would require a template modification every time I change a custom field works fine, but I rather have the more advanced option work for ease of use.
Here's the template code I used: PHP Code:
PHP Code:
|
#56
|
|||
|
|||
I'm just going to assume I'm being ignored...
|
#57
|
|||
|
|||
hi need help converting this into a plugin for postbit_legacy for the following template hook
$template_hook['postbit_userinfo_right_after_posts'] HTML Code:
<vb:if condition="$post['field5']"> <dt>eRepublik</dt> <dd><a href="http://www.erepublik.com/en/citizen/profile/{vb:raw post.field5}"><img src="http://www.legijastranaca.com/images/erep/citizen.png" alt="Citizen link" width="25" height="24" border="0"></a><a href="http://www.erepublik.com/en/main/messages-compose/{vb:raw post.field5}"><img src="http://www.legijastranaca.com/images/erep/message.png" alt="Message Citizen on eRepublik" width="24" height="24" border="0"></a><a href="http://www.erepublik.com/en/economy/donate-items/{vb:raw post.field5}"><img src="http://www.legijastranaca.com/images/erep/donate.png" alt="Donate Items" width="24" height="24" border="0"></a></vb:if> |
#58
|
||||
|
||||
Did you try converting it using this as an example?
PHP Code:
|
#59
|
|||
|
|||
is there any plugin to download to just simply change it without adding code to some templates?
|
#60
|
||||
|
||||
Under the More Advanced section of my post, I posted the plugin codes. I cannot write a plugin for you to download since you need to enter the fieldid.
|
#61
|
|||
|
|||
Quote:
i want to do something like this PHP Code:
|
Thread Tools | |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|