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:
|
#12
|
||||
|
||||
If your profile field is a link - http://something.com/image.png - then just use an image tag:
HTML Code:
<img src="{vb:raw userInfo.customFields.category1_title.field7_title.val}" alt="something" height="yy" width="xx" />
|
#13
|
|||
|
|||
gorgeous.
thank you so much for your help --------------- Added [DATE]1367785526[/DATE] at [TIME]1367785526[/TIME] --------------- Now, I'm actually curious if there is a way to do the exact same thing in the profile area. Instead of the field.value being displayed on the profile page, could it be replaced with an image in the exact same way as in the postbit template? thanks for placating my curiosity! |
#14
|
||||
|
||||
Quote:
You could probably do something similar on the profile page, but I don't see a hook there so it looks like you would need to edit the widget_profile_sidebar template manually to do it. I haven't looked into it at all, but my guess is the variable names will be different also. |
#15
|
||||
|
||||
I am getting this error:
Warning: Illegal string offset 'field5' in [path]/includes/adminfunctions_template.php(4638) : eval()'d code on line 3 Not sure what I am missing in the install. |
#16
|
||||
|
||||
And exactly what did you enter into your template? (Use code tags)
|
#17
|
||||
|
||||
Code:
{vb:data userInfo, user, fetchProfileInfo, {vb:raw conversation.userid}} Code:
<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> |
#18
|
||||
|
||||
You have two different code sections above, why? Are they in two different templates or what? Is that all that is in the template? And can we get a screenshot of your Field 5 edit page so we can we it's field id and type and category, etc. And did you create the hook and is the plugin system enabled?
|
#19
|
||||
|
||||
Sorry about the 2 code fields. I have the below in the new conversation_fields template
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> The hook system is on. My new field is uncategorized field 5. Attachment 145161 Thanks Lynne! |
#20
|
||||
|
||||
Is there some odd text in the text box for that field for the user?
I honestly see nothing wrong with what you have. I'd try removing some of it and seeing if you can see exactly what part of that template is causing the error. |
#21
|
||||
|
||||
The error I originally posted comes up when I save the template. I haven't added anything else to the template besides an additional_css mod to make the header logo larger. Other than that my vB version is completely default.
How would I go about completely removing what I have done thus far and starting over? |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|