Go Back   vb.org Archive > vBulletin Article Depository > Read An Article > Programming Articles
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
How To Add Custom Profile Field Information To The Postbit
peterska2
Join Date: Oct 2003
Posts: 6,504

 

Manchester, UK
Show Printable Version Email this Page Subscription
peterska2 peterska2 is offline 06-16-2006, 10:00 PM

So you've added some custom profile fields and would like the information to display in the postbit, but how do you go about it? This guide will help you to do this.

Throughout this guide the x in fieldx is to be replaced with the field number as shown in the profile field manager in the name column.

Single Line Text Boxes

To add the contents of a single line text box to the postbit, use one of the following formats:

To use a title for the displayed text (eg Real name: Kerry-Anne)
Code:
<if condition="$post[fieldx]"><div class="smallfont">Label for text: $post[fieldx]</div></if>
To simply display the text (eg Kerry-Anne)
Code:
$post[fieldx]
Multiple Line Text Boxes

While I don't recommend displaying these in the postbit as they can contain a large amount of information, they are done in the exact same way as the single line text box.

Note: The text entered will display all on one line, not in multiple lines as added to the text box and displayed in the profile page.


Single Selection Radio Buttons & Single Selection Menus

These both display text in the same way as the Single Line Text Box so the same format can be applied to these. However, as these are mainly used for fixed options (eg Date of Birth, or Homepage contains adult content here at vB.org) they can also be used to display images (eg the gender in postbit modification).

These examples, using images, assume that you have uploaded the images to your misc image directory for the style that you are using. You can replace
Code:
$stylevar[imgdir_misc]
with the appropriate path to your images if different. They also assume that the file type of the images is gif. If this is different, you will need to alter it in the code by replacing
Code:
.gif
with the appropraite extension. Your image names need to be exactly the same as the profile field options, including capitalization.

To use the contents to display an image, with no label, use the following format:
Code:
<if condition="$post[fieldx]"><div><img src="$stylevar[imgdir_misc]/$post[fieldx].gif" border="0" alt="$post[fieldx]" /></div></if>
To show a label before the image, use the following format:
Code:
<if condition="$post[fieldx]"><div class="smallfont">Label for image: <img src="$stylevar[imgdir_misc]/$post[fieldx].gif" border="0" alt="$post[fieldx]" /></div></if>
Multiple Selection Menus and Checkboxes

I wouldn't recommend using these to display information in the postbit, as to enable them requires long usage of conditionals to translate the code saved in the database into displayable text.


I hope you find this useful. Feel free to ask any questions related to this.
Reply With Quote
  #12  
Old 08-08-2006, 12:35 AM
Wired1's Avatar
Wired1 Wired1 is offline
 
Join Date: Nov 2003
Location: Orlando, FL, USA
Posts: 1,361
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Just found it, eep, that sucks. Time to use the ol' noggin I wonder if there's a way to let a *.php or template access the custom profile fields phrases, or to somehow auto-copy specified ones to a custom global phrase. Got any ideas?

What about 3.5.x, how does it store the titles?
Reply With Quote
  #13  
Old 08-08-2006, 12:48 AM
peterska2 peterska2 is offline
 
Join Date: Oct 2003
Location: Manchester, UK
Posts: 6,504
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

3.5.x doesn't store them as phrases, it just stores the plain text if I recall correctly.
Reply With Quote
  #14  
Old 10-30-2006, 08:49 PM
cookiepants cookiepants is offline
 
Join Date: Jul 2006
Location: Nor Cal
Posts: 118
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I've been looking all over for something like this. Thank you so much!
Reply With Quote
  #15  
Old 11-29-2006, 04:04 AM
DarkDraco07's Avatar
DarkDraco07 DarkDraco07 is offline
 
Join Date: Apr 2002
Posts: 414
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

can anyone post a global code so post[fieldx] can be used on any page? thx T_T
Reply With Quote
  #16  
Old 04-06-2008, 12:42 PM
muan muan is offline
 
Join Date: Feb 2006
Posts: 24
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Great tutorial, thanks for that
Reply With Quote
  #17  
Old 05-07-2008, 10:55 AM
TimberFloorAu's Avatar
TimberFloorAu TimberFloorAu is offline
 
Join Date: May 2008
Location: Brisbane
Posts: 2,264
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Was given this link, as per a request. On VB' .com

Sweet tut' thanks.

Only thing to add, may not work on postbit.

I found i had to edit postbit legacy too.

Ozzy
Reply With Quote
  #18  
Old 05-27-2008, 01:58 AM
oz_girl's Avatar
oz_girl oz_girl is offline
 
Join Date: Mar 2008
Location: Australia
Posts: 48
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Great tutorial
Reply With Quote
  #19  
Old 05-29-2008, 08:49 PM
stardotstar stardotstar is offline
 
Join Date: May 2008
Location: SYD, AU
Posts: 156
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I have a request about how vB handles language keys and image associations. I had a postbit and user profile mod for phpBB which managed this and I have only just started looking at modding vB.

The simple addition of a country flag illustrates this well.
flag_au.GIF --> Australia.GIF works but that requires renaming all the flags according to the names in the list whilst the original bundle already provides a translation key:
...
au=Australia
...
in phpBB this is done using a language key where anything called for as 'au' shows up as 'Australia'; then the menu list would be the list of keys
...
au
...
which is an easier job to edit than the actual file names - including the fact that there are spaces and capitalisation in the file names and also some exceptions to the two letter country code etc...

There must be some simple code that would allow the supplied list to be used in both the dropdown and the image file translation without a lot of editing?

Language key:
at=Austria
au=Australia
aw=Aruba
ax=Aaland

Drop down menu is then set up as

at
au
aw
ax

but displays to users as

Austria
Australia
Aruba
Aaland

and when one is selected by the language key in the profile it translates to:

flag_at.GIF
flag_au.GIF
flag_aw.GIF
flag_ax.GIF

or

flag_$post[fieldX].GIF

I hope this is a reasonable place to ask this question.
Reply With Quote
  #20  
Old 06-13-2008, 04:38 AM
bornoffire bornoffire is offline
 
Join Date: Apr 2007
Posts: 161
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I wanted to use a title for the displayed text option but dont know where i place the code, please help!
Reply With Quote
  #21  
Old 09-10-2008, 06:17 PM
jammer2552 jammer2552 is offline
 
Join Date: Jul 2008
Posts: 5
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

[s]I would like to use the custom profile field in other places than the postbit, for use as a Display Name.
Just realized $post[field5] wouldn't work when I went to the "Who's Online" template...
$userinfo[field5] and $vbphrase[field5] didn't work either.

SOMEONE?! PLEASE?![/s]

$bbuserinfo[field5] did the trick.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 04:14 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04800 seconds
  • Memory Usage 2,305KB
  • Queries Executed 25 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (6)bbcode_code
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_article
  • (1)navbar
  • (4)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (3)pagenav_pagelink
  • (11)post_thanks_box
  • (11)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (11)post_thanks_postbit_info
  • (10)postbit
  • (11)postbit_onlinestatus
  • (11)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete