vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   Quick Question (https://vborg.vbsupport.ru/showthread.php?t=117263)

dudeness3 06-01-2006 02:40 AM

Quick Question
 
I have a Pokemon forum and I want to put a dropdown list in "Edit Profile" listing 386 names, when a user chooses a name, the sprite of that chosen name appears in their postbit, representing what their favorite pokemon is.
can this be done?

Lea Verou 06-01-2006 03:51 AM

Yes it can.

dudeness3 06-01-2006 04:04 AM

thats great, at least i know it can be done, thank you

checkmail 06-01-2006 04:06 AM

Atleast he didn't lie that it was quick

antialiasis 06-01-2006 04:13 AM

Yes, it can be done. (Admittedly, I highly don't recommend putting the sprite in the postbit - too many images in the postbit can be distracting and annoying. But each to his own.)

First, if you really want to go through with the sprites thing, you'll have to get all the Pok?mon sprites with their names as their filenames somehow. You can look around yourself (or, better yet, you may have them already or know a place where you can get them), but if you don't have them and can't find any, you can just ask me to zip them for you. Just upload them in a special folder called sprites or something under images at the forums.

Now go to Admin CP -> User Profile Fields -> Add New User Profile Field

As Profile Field Type, choose "Single-selection Menu"

Apply these settings (modify at will, of course):

Title: Favorite Pok?mon
Description: Pick your favorite Pok?mon.
Set Default: None
Display Order: (leave it as it is)
Field Required: (whichever you want)
Field Editable by User: Yes
Private Field: No (unless you don't want it shown in people's profile)
Field Searchable on Members List: (whichever you want)
Show on Members List: (whichever you want)
(leave all the "Optional Input" stuff like it is)
Display Page: Edit Profile

Now, for the options, you would normally have to type out the names of all 386, but as it happens that I'm also a Pok?mon fan and have too much time on my hands, I have a Pok?mon list generator on my website. Just enter %[name]% into the field, press the Submit button, copy everything in the textarea, and paste it into the options field.

Now press Save at the bottom of the user profile field manager. It should bring you back to the list of user profile fields. Find the field you just added, remember the "name" (which will be something in the direction of field123), and go to the Style Manager under Styles and Templates on your Admin CP menu. From there, select each of your styles in order, go to Edit Templates, and edit either postbit or postbit_legacy (located under "Postbit templates"), depending on which you are using.

Now, just find the appropriate place in the code, and add this:

Code:

<if condition="$post['field123']"><img src="images/sprites/$post[field123].gif" alt="$post[field123]" /></if>
Of course, if your sprites have some other extension than .gif, such as .png, change the extension in the code accordingly, and replace field123 in all three places with the field name of your favorite Pok?mon field.

And if you did all this correctly, it should show up for all users who have specified a favorite Pok?mon.

Lea Verou 06-01-2006 04:19 AM

He can disable avatars and put that image instead. So he wont have many images.
In fact I think it's a great idea for a pokemon forum.

Quote:

Originally Posted by antialiasis
Now, just find the appropriate place in the code, and add this:

Code:

<if condition="$vbulletin->userinfo['field123']"><img src="images/sprites/$bbuserinfo[field123].gif" alt="$bbuserinfo[field123]" /></if>

I don't think that would work. AFAIK it would be:

Code:

<if condition="$post['field123']"><img src="images/sprites/$post[field123].gif" alt="$post[field123]" /></if>
Remember, we are talking about the postbit.

antialiasis 06-01-2006 02:21 PM

Yeah, slip-up. Sorry. Should be what Michelle said.

Shows me not to attempt to write tutorials at five in the morning...

dudeness3 06-06-2006 02:09 AM

wow thanks, thats perfect, and btw, I had all the sprites uploaded anyway, but thanks so much, and I'm glad I found a pokefan :)


All times are GMT. The time now is 11:19 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01101 seconds
  • Memory Usage 1,731KB
  • 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
  • (3)bbcode_code_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (8)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