The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
[vB5] User Profile Fields in the postbit templates
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: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: YesNow go to Admincp > Styles & Templates > Style Manager > Add New Template and on that page, set the following: Title: conversation_fieldsFor each field you want shown, you will need to add this code under that line: 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 CategoryThen my template would look like this: That's it! If running 5.1.0, there is a code fix to apply here. Quote:
|
#22
|
||||
|
||||
Just delete the template and delete the hook and it's gone.
|
#23
|
||||
|
||||
Ok, so I played around with the code to see if I could get it to at least save without any errors. By changing
Code:
"$userInfo['field5']" Code:
"$userinfo['field5']" ...the template saved and reloaded. Then I changed it back to capital "Info", still got the error but when I clicked Go Back, it pushed through and saved all of a sudden. Then the Custom Profile field is displayed in the postbit...but overlapped the Online status button. I added a <br> underneath the conversation_userstats hook in the coversation_userinfo template and it seems to all be working correctly now. Hopefully this will help the next person! :erm: |
#24
|
||||
|
||||
Hmmmm, are you sure your hooks are enabled and you have a hook written (and active) exactly like what I wrote?
|
#25
|
||||
|
||||
Yes, hook system is on and the hook is written exactly as you wrote. I don't know that my issue was caused by my error or your mod. By performing a quick search I found 1 other person who had the same issue, but he/she posted on vb.com and was directed here without resolution. The point is that it now works with the only changes being the line break I had to put in to align the postbit correctly. With the amount of errors and bugs I have already encountered with vB5 I can't say I'm surprised!
|
#26
|
||||
|
||||
Exactly the same thing here
When creating the template it self i get this: Warning: Illegal string offset 'field5' in [path]/includes/adminfunctions_template.php(4704) : eval()'d code on line 2 v. 5.0.2 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> After saving it with a lower case I it saved but its not showing up. Hooks are active and set exactly as instructed. Template name is the same everything is the same but it does not show up. Do i need to add something to conversation_userinfo to make it show up? wow i made it work by putting 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> where i want the gender to be displayed. Now another question: Field is Gender and can i set an image to show for each choice? (male / female signs) |
#27
|
||||
|
||||
Very odd. I cannot get it to give me that error at all on either of my test sites when I enter exactly what you guys are entering.
Do you have the plugin system enabled? As for an image, just use a condition: Code:
<vb:if condition="$userInfo['field5'] == 'female'">image code here <vb:else /> other image code here </vb:if> |
#28
|
||||
|
||||
nope.
nothing ON right now hmmm... really strange check your pm some private details there. if we find a solution it will be posted thank you for the IMG thing .. i will check it as soon as possible and report back to you |
#29
|
|||
|
|||
I have a problem with this code.
I made a text profile field but only the title is showing in the postbit. Example: CnR Username : I already changed the CnR Username in my profile. How to fix it for not showing as blank? |
#30
|
||||
|
||||
Post your exact code or it's impossible to help.
|
#31
|
|||
|
|||
Here you go:
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.category5_title.field5_title.val}</span></li></vb:if> |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|