PDA

View Full Version : [How To] Add a costum user field in postbit



Eqvaliser
21-12-2009, 06:36 PM
1) AdminCP > User Profile Fields > Add new user profile field (click)

2) Profile field type, (in this case we use single-line text box) > continue

3) Fill in information you want ; i used as exsample
Title : OSDescription : Operating systemProfile Field cat. : UncategorizedDefault value : win Max length : 10Field length : 25Display order : 6Title : OSRequired : NoEditable : YesPrivate : NoOn members list : YesExpression : --- Display page : Edit profile

> save

4) See what the name of your field is in the colum Name.. fieldX (red x is the number)

5) Styles and templates > Dropdownbox > Edit templates >
5a) Postbit Templates >> Postbit (OR) postbit_legacy depending on your forum setup.
This style on evisystems.org is "postbit_legacy" with userinfo left of the post..

6) open it, in search enter
{vb:rawphrase join_date}
and click find.

below that entire line which ends with </vb:if>
make a new lin and enter this code

<br /><vb:if condition="$post['fieldX']">OS : {vb:raw post.fieldX}</br></vb:if>

Replace the red X's with the field number..

And if you look in the user info to the left you can see the costum user field,
and can change it in UserCP

Eqvaliser:paladin:

Eqvaliser
22-12-2009, 10:26 PM
Plugin Update.

If you dont want to Edit your templates, you can add it in a plugin instead.
also easyer to remove and allows upgrade seamlessly.

After you have created your costum userfield from the post above..
Head to

AdminCP > Plugins & Products > Add New Plugin

Add following :


Product : vbulletin (or costum)
Hook : postbit_display_complete
Title : Costum OS field
Execution Order : 5, or whatever you prefer
Plugin php code :
if (!empty($post["fieldX"]))
{
$template_hook['postbit_userinfo_right_after_posts'] .=
'<dd>' . 'Test : ' . $post["fieldX"] . '</dd>';
}
Plugin active : Yes


And your all set, head to a forumpost and see how it looks..
Look in the left, the "Test : Testcontent" is added via plugin.

Enjoy. :paladin: