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:
|
#52
|
|||
|
|||
I'm using 5.1.3 A6 and I still cannot get this to display the profile fields, here is the code I am using in the template conversation_fields
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> <vb:if condition="$userInfo['field2']"><li><label>{vb:phrase field2_title}:</label> <span>{vb:raw userInfo.customFields.default.field2_title.val}</span></li></vb:if> |
#53
|
||||
|
||||
I just put your code into the template on my site and it works just fine.
If you are still getting the This is a Serious Error message on your page, then go into debug mode and see what the real error is. To enable debug mode edit the /config.php file and change: Code:
$config['debug'] = false; Code:
$config['debug'] = true; Code:
// $config['Misc']['debug'] = true; Code:
$config['Misc']['debug'] = true; Code:
if($_SERVER['REMOTE_ADDR'] == "xxx.xxx.xxx.xxx") { CODE HERE } |
#54
|
|||
|
|||
How would I display a piece of information in the postbit only if the user VIEWING the page is logged in and in the supermoderator or admin user group?
--------------- Added [DATE]1407644438[/DATE] at [TIME]1407644438[/TIME] --------------- Actually, I think I got it... but this could probably be cleaned up... I'm also not 100% sure membergroupids is an array? This is vb5.1.2 <vb:if condition="in_array($bbuserinfo[usergroupid], array(5,6,16))"> <vb:if condition="in_array($userInfo['membergroupids'], array(14,15))"> <span style="color:red;font-weight:bold;">Display Stuff Here</span><br> </vb:if> </vb:if> --------------- Added [DATE]1407645650[/DATE] at [TIME]1407645650[/TIME] --------------- And one more update... userinfo['membergroupids'] shows up as a string when I do a debugvardump. How do I check to see if it contains the group ID? vBulletin doesn't allow you to search in a string according to http://bit.ly/1uBdO1U |
#55
|
||||
|
||||
I believe is_member_of is the function your would want to use.
<vb:if condition="is_member_of($bbuserinfo, 5, 6, 16)"> <vb:if condition="is_member_of($userInfo, 14, 15)"> |
#56
|
|||
|
|||
Thanks for the tutorial!
I show my result |
#57
|
|||
|
|||
hi
I can not find Admincp > Styles & Templates > Style Manager > Add New Template Instead There is : Add New style And there is no place to add code |
#58
|
||||
|
||||
Add New Template is a dropdown next to the style. The default dropdown will say Style Variable Editor, so just click on that to see the other options.
|
#59
|
|||
|
|||
Quote:
dropdown option :edit setting add child style download delete style I added a child style and did change it and the problem was solved. Thank you. |
#60
|
|||
|
|||
Hello--
I am following this tutorial and have created a new category called "Custom" and added a new field called "industry". "Industry" has several check boxes for the user to check. The "Custom" category has ID = 1 and the industry field is field=5. I created and added this code to a template called "conversation_fields": PHP Code:
Thanks. |
#61
|
||||
|
||||
That looks like it should work. Can I get a screen shot of your profile field 5?
|
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|