vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   Programming Articles (https://vborg.vbsupport.ru/forumdisplay.php?f=188)
-   -   How To Add Custom Profile Field Information To The Postbit (https://vborg.vbsupport.ru/showthread.php?t=118896)

peterska2 06-16-2006 10:00 PM

How To Add Custom Profile Field Information To The Postbit
 
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.

zooki 06-21-2006 10:46 PM

THanks very much Peter :) i will try it out later tomorrow.

Princeton 06-22-2006 12:26 PM

Very helpful! :up:

SDTA 06-22-2006 01:24 PM

:up: Thanks for this.

How would I make the Single Line Text Boxes into a link:

For instance I would like a link that says "MY JOURNAL" to appear in the postbit...

bashy 06-22-2006 08:51 PM

Hi KA

Can you please take a look at my thread HERE It is slightly related to this although i have only just found this thread, I have managed to get mine to show in the postbit but i want more from it, all explained in the thread :)

TiA

Sir_Yaro 07-26-2006 03:52 PM

thank you

Shazz 07-26-2006 03:54 PM

Thanx its helpful, but what if i want to hide something in the postbit?

Like example if i wanted to hide Posts: 175

And they have an option to click yes or no in the profile field...
*Noob question
________
Ford Versailles history

L9IAnime 07-30-2006 09:04 AM

extremely helpful tutorial, exactly what i was looking for, thankyou so much :)

Wired1 08-08-2006 12:08 AM

Hehe, looks like a hack of mine :)

Question: Where is the Profile Field Title stored, and how can one call it, for instance, to replace the "Label for text"?

peterska2 08-08-2006 12:18 AM

In 3.6 it is stored as a phrase in the custom profile fields phrases but this isn't available globally. The best way is to either hard code or to add a custom global phrase for it.

Wired1 08-08-2006 12:35 AM

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?

peterska2 08-08-2006 12:48 AM

3.5.x doesn't store them as phrases, it just stores the plain text if I recall correctly.

cookiepants 10-30-2006 08:49 PM

I've been looking all over for something like this. Thank you so much!

DarkDraco07 11-29-2006 04:04 AM

can anyone post a global code so post[fieldx] can be used on any page? thx T_T

muan 04-06-2008 12:42 PM

Great tutorial, thanks for that :)

TimberFloorAu 05-07-2008 10:55 AM

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

oz_girl 05-27-2008 01:58 AM

Great tutorial :)

stardotstar 05-29-2008 08:49 PM

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.

bornoffire 06-13-2008 04:38 AM

I wanted to use a title for the displayed text option but dont know where i place the code, please help!

jammer2552 09-10-2008 06:17 PM

[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. :)

Macartist6 10-08-2008 02:33 PM

anyone want to do this on my site for me???... this is way over my head... PM me

I'll Pay you via PayPal

--------------- Added [DATE]1223485311[/DATE] at [TIME]1223485311[/TIME] ---------------

I got someone thank you!

mmoore5553 12-03-2008 12:22 PM

does anyone know how to make this show up on thread ....under there name and show a picture ? i added the custom user group but cant find where to modify it ..i looked up nder post legacy

msn - mmoore@smoothstone. com

--------------- Added [DATE]1228324154[/DATE] at [TIME]1228324154[/TIME] ---------------

oh here is my example ..i have choices ... 1 2 3
if they pick1 they get this gif by there name or under it or beside dont matter to me
if they pick 2 they get this other picture or gif
if they pick 3 they get this other pic or gif ...

i know what needs to be done but cant figure it out for love of me ...i have paypal

DarkFormula 12-31-2008 11:23 PM

FYI, there's nowhere specified where to add this in the template, and adding it under existing fields called for causes an error of "The conditional on line 62 appears to be missing its beginning tag (<if>). This may cause unexpected behavior."

mmoore5553 01-01-2009 02:28 AM

i actually figured out how to add special modifications on my site ..

www.cg-hq.com

i have them pick what 3d software they use adn then it adds a picture under there avatar ...just to let you know this guide plus another helped me

Lynne 01-01-2009 02:35 AM

Quote:

Originally Posted by DarkFormula (Post 1698218)
FYI, there's nowhere specified where to add this in the template, and adding it under existing fields called for causes an error of "The conditional on line 62 appears to be missing its beginning tag (<if>). This may cause unexpected behavior."

They can't tell you exactly where to add it in the template because everyone wants to add their stuff in a different place. It is assumed you will make sure you are not replacing an <if> tag, or doing something else to 'break' the html in the template.

DarkFormula 01-01-2009 03:16 AM

Quote:

Originally Posted by Lynne (Post 1698282)
They can't tell you exactly where to add it in the template because everyone wants to add their stuff in a different place. It is assumed you will make sure you are not replacing an <if> tag, or doing something else to 'break' the html in the template.

Where would be the best place to add it, then? I've tried several places and the error always appears, just with a different line reference.

Lynne 01-01-2009 02:38 PM

Why don't you post the line you are adding and the code a few lines above and below that part in your template and see can see what is wrong.

makofu 01-05-2009 08:43 PM

Quote:

Originally Posted by DarkFormula (Post 1698298)
Where would be the best place to add it, then? I've tried several places and the error always appears, just with a different line reference.

I got the same thing initially...realized I forgot to add a quote in my <if ....> statement. Make sure you have all of your quotes in place.

selwonk 01-06-2009 09:38 AM

Great tutorial! Is there any way to only show the profile field once per page? For example, I run a motoring forum and I show the user's "garage" beneath their signature* but I'd like to only show it on the first post per page for that user

Thanks in advance!

* Not within so that it always shows the garage regardless of whether they have a signature or not

Lynne 01-06-2009 02:29 PM

Quote:

Originally Posted by selwonk (Post 1703107)
Great tutorial! Is there any way to only show the profile field once per page? For example, I run a motoring forum and I show the user's "garage" beneath their signature* but I'd like to only show it on the first post per page for that user

Thanks in advance!

* Not within so that it always shows the garage regardless of whether they have a signature or not

That is really beyond the scope of the article. If you want to do that, I suggest you have a look at the modification to only have a signature show up once on a page. Modify that code for use with your profile fields.

punchbowl 01-15-2009 07:04 PM

exactly what I need! ty

DivineMessenger 01-28-2009 06:35 PM

How can I choose an image and have it link to the url in the profile field. Like if I wanted to put a lil facebook image and have it go to their profile field "facebook profile"

Iceburg22 02-10-2009 01:55 AM

the site I am working on currently has something like 4000 members. I want to add a new profile field and it have a default of 0. Is there some kind of query that I need to run to have every member's profile field have a default answer of zero? If so how do I do this?

RoyT 05-05-2009 01:08 PM

Hmmm, I'm a bit lost, I'm sure it's just me but I can't see where I actually place this code?

Do I need to also give it positional information as well?

What I'm trying to do is this :https://vborg.vbsupport.ru/showthrea...83#post1804983

Naturally, I'm a noob to Vbulletin customisation :)

DesignerDani 06-17-2009 03:43 PM

Thank you! This was so quick and simple. It took about 2 minutes to do.

N-0p3rz 07-05-2009 02:04 AM

Quote:

Originally Posted by Shazz (Post 1038043)
Thanx its helpful, but what if i want to hide something in the postbit?

Like example if i wanted to hide Posts: 175

And they have an option to click yes or no in the profile field...
*Noob question

I'm looking for something similar to this question. Anyone have an idea of how to achieve this?

--------------- Added [DATE]1246771254[/DATE] at [TIME]1246771254[/TIME] ---------------

Ahh mkay I got it..

Using:

PHP Code:

<if condition="$bbuserinfo[fieldX] == 'YES'"></if> 


RoG Aftermath 09-03-2011 12:16 AM

Ok this may sound like a dumb question but where am i supposed to put this code to make it show in the postbit? I tried putting it in the regular expression area and nothing came up on the postbit. I am running the newest version of vbulletin 4.1.5

brandondrury 01-27-2013 09:03 PM

I'm guessing this doesn't work for vB4. My html code is being displayed literally on the page and not parsing.

Edit: Here's a guide. https://www.vbulletin.com/forum/show...tbit-templates

Lynne 01-27-2013 11:47 PM

There is a different one for vB4 in the vB4 articles area (and in my profile since I was the one who wrote it).


All times are GMT. The time now is 01:14 PM.

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.01665 seconds
  • Memory Usage 1,822KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (6)bbcode_code_printable
  • (1)bbcode_php_printable
  • (5)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (39)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.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/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.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
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete