vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   Multiple-Choice userfield->Postbit options? (https://vborg.vbsupport.ru/showthread.php?t=218138)

MTGDarkness 07-08-2009 01:09 PM

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?

Lynne 07-08-2009 02:02 PM

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.

MTGDarkness 07-08-2009 04:31 PM

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?

Lynne 07-08-2009 10:25 PM

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

MTGDarkness 07-09-2009 03:55 AM

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?

Lynne 07-09-2009 02:31 PM

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?

MTGDarkness 07-09-2009 03:30 PM

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.

Lynne 07-09-2009 06:18 PM

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

MTGDarkness 07-09-2009 07:12 PM

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.

Lynne 07-09-2009 10:20 PM

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.


All times are GMT. The time now is 08:14 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.01277 seconds
  • Memory Usage 1,737KB
  • 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)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)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
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete