Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 Programming Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 07-08-2009, 01:09 PM
MTGDarkness MTGDarkness is offline
 
Join Date: Dec 2008
Posts: 270
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Multiple-Choice userfield->Postbit options?

[backstory]
My forum has a clans section. Each clan has their own emblem, banner, ideals, etc. However, the clans section has sort of been lacking lately. And the idea came up to have it so that you could select your clan over your UCP and then have an icon and link to it show up in your postbit. [/backstory]

I've seen this before on a forum called "smashboards" where you can select which character you use in the game and then it shows up in the postbit. I PM'd the admin there and he gave me this:

"It's basically just a custom field, a small plugin, and a template adjustment. The plugin takes the custom field and generates the URL of the postbit icon, and the template just includes the image in the postbit."

However, I don't really know how to do this... Help?
Reply With Quote
  #2  
Old 07-08-2009, 02:02 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

It sounds like he is saying he added a new field to the database (although why not use a User Profile Field?) and then has a plugin that take the result of that field and creates a url based on it (if TheField=1, then the url is xxxxx, if TheField=2, then the url is yyyy) and the template just spits this out.

I don't know why you wouldn't use a User Profile Field for this. Then, create a plugin to spit out a url based on that field.

The best thing to do is find another modification that does something with a (multiple-choice) User Profile Field and see how they did things and modify it for your own use. I think there was a country flag mod out there that may be setup like this. Play with it on a test site.
Reply With Quote
  #3  
Old 07-08-2009, 04:31 PM
MTGDarkness MTGDarkness is offline
 
Join Date: Dec 2008
Posts: 270
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

No, he is using a user profile field. That's what I meant. I'll see what I can do...

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

Is it possible to do it over template variables?
Say, something like this:

Code:
<if condition="$post[fieldX1]=something here?">stuff</if>
If so, what would something here be?
Reply With Quote
  #4  
Old 07-08-2009, 10:25 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I don't know what you mean by "do it over template variables". You can do a condition in the template, if you want. As for the something here.... um, if you are using a multiple-choice textbox, you can see how to do that here - http://www.vbulletin.com/forum/showthread.php?t=108785 (see post 2).
Reply With Quote
  #5  
Old 07-09-2009, 03:55 AM
MTGDarkness MTGDarkness is offline
 
Join Date: Dec 2008
Posts: 270
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

On a Single-Selection Menu with following options:

none
[Izzet]
[Soundtrack]
[Aesir]
[The Banana]

This is the code I'm using:

Code:
<if condition="$post['field9'] & 2">
<!-- Izzet --> <a href="http://forums.mtgdarkness.com/showthread.php?t=21665"><img src="http://img515.imageshack.us/img515/4530/izzeticon.png" alt="[Izzet]" /></a>
</if>


<if condition="$post['field9'] & 4">
<!-- Soundtrack -->	
</if>


<if condition="$post['field9'] & 8">
<!-- aesir -->	
</if>

<if condition="$post['field9'] & 16">
<!-- banana -->	
</if>

It isn't working. >.< Nothing shows up in the source code regardless what you select.

What's wrong with it?
Reply With Quote
  #6  
Old 07-09-2009, 02:31 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Right now, nothing should show up unless they picked the option Izzet. Did you put the code in the correct postbit - which one? You didn't say where you put it at all, which makes it difficult to guess what may be wrong. What lines are before it and after it (just three or four lines should be fine)? Is anything showing in the page source?
Reply With Quote
  #7  
Old 07-09-2009, 03:30 PM
MTGDarkness MTGDarkness is offline
 
Join Date: Dec 2008
Posts: 270
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I put it in its own template, which I then linked to in the postbit. (I tested it by putting a non-conditional comment in there which does appear correctly).

Why shouldn't anything happen unless they've chosen izzet? Or do you mean nothing except comments? Even the izzet aren't showing their icon... The lines before and after are these:

Code:
<if condition="$show['popups']"><script type="text/javascript"> vbrep_register("$post[postid]")</script></if>
		</if>

$clans

		<if condition="$show['infractionlink']"><a href="infraction.php?$session[sessionurl]do=report&amp;p=$post[postid]" rel="nofollow"><img class="inlineimg" src="$stylevar[imgdir_button]/infraction.gif" alt="<phrase 1="$post[username]">$vbphrase[add_infraction_for_x]</phrase>"
Where $clans is the template variable (I set up the plugins for that right as well) leading to the code posted above.
Reply With Quote
  #8  
Old 07-09-2009, 06:18 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Try putting the code directly into the template and get it to work. Then see about putting it into it's own template and evaling it in a plugin (hook location and exact code? You should give all information when saying something isn't working.).
Reply With Quote
  #9  
Old 07-09-2009, 07:12 PM
MTGDarkness MTGDarkness is offline
 
Join Date: Dec 2008
Posts: 270
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

No, it works. What I did was put the following snippet of code outside of all the conditionals in the template:

<!-- Clans -- >
And when I looked in the source code, that showed up in the postbit. The problem really can only be with the conditionals.
Reply With Quote
  #10  
Old 07-09-2009, 10:20 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I thought you said you were doing a multiple choice userfield? The method/conditions you are using are for a multiple choice userfield, not a single selection field. You would use the normal method (a basic comparison) for a single selection field.
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 02:48 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.05161 seconds
  • Memory Usage 2,259KB
  • Queries Executed 13 (?)
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
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (3)bbcode_code
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (10)postbit_onlinestatus
  • (10)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_postinfo_query
  • fetch_postinfo
  • 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