Log in

View Full Version : Displaying custom fields


chris1979
11-07-2007, 05:04 PM
The members of my site are known by their real names instead of their usernames. So on pretty much every page, I want to display the custom fields they put their real name in. (customfield6 and customfield7)

On the postbit page, I can use $post[field6] and $post[field7].

I think I need to edit the code to make that work on other pages. Can anyone give me some clues of what I need to edit?

RedGTiVR6
11-07-2007, 06:46 PM
You would go to the Custom Profile Fields in the AdminCP and add in the field you want, taking note of the field number.

On our forum I have it set for vehicle information, it's field5 on our forum.

We use postbit_legacy and this is the code I added:

<if condition="$post['field5']"><div>$vbphrase[field5_title1]: $post[field5]</div></if>

I used that under the location field:

<if condition="$post['field2']"><div>$vbphrase[location_perm]: $post[field2]</div></if>

I hope that helps!

I should also note that you will need to create a custom phrase for this to work as well. That's what field5_title1 calls to display on the page. I have field5_title1 mapped to Vehicle. The product should be vBulletin when you set up the phrase.

chris1979
11-07-2007, 07:26 PM
Sure, I know the field numbers already - it's fields 6 and 7. And in postbit, it works fine - I just put $post[field6] and $post[field7] into the template and their names show up above their posts.

How do I add that same info on other pages though?

Like on the calendar, for example - I want their real name to appear next to the events they've added to the calendar. I can display their username easily ($eventinfo[musername]) but I don't know how I can add the custom fields.

Any ideas?

chris1979
11-09-2007, 05:08 PM
Any tips will be really appreciated.