vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   How to make a simple 'option' (https://vborg.vbsupport.ru/showthread.php?t=78289)

Borgs8472 03-17-2005 09:52 PM

How to make a simple 'option'
 
Hey all.

Say I make a really simply template change that I want to be optional.

( the case in question, I want users to be able to choose to have the forum catergory icons on or off )

Currently I've done this in a rather messy way, having one skin set with the forum catergory icons, each skin set with a child skin with the mod to remove those icons.

Now surely I should be able to stick a yes/no choice in somewhere, say on the user optionsm say in the visible post elements section of the usercp:

/forum/profile.php?do=editoptions
Quote:

You have the option to show or hide various elements of messages, which may be of use to users on slow internet connections, or who want to remove extraneous clutter from posts.
Show Signatures
Show Avatars
Show Images (including attached images and images in [IMG] code)
Show forum catergory icons
How can I make a choice there effect my code? I know it's simple but I'm still new at this kind of coding...

filburt1 03-18-2005 04:53 AM

In your template, use a conditional:
HTML Code:

<if condition="$bbuserinfo['fieldn']">
    <!-- code if "Show forum category icons" is checked -->
</if>

Change the "n" in "fieldn" to match the ID of the new field. Also note your typo for category in case you made it for the actual field as well.

Borgs8472 03-19-2005 08:58 AM

^ ^
okay, that makes sense, thanks.

But how do I then add the necessary line of code to allow user selection of that choice?

Deaths 03-19-2005 09:28 AM

It does it automaticly when adding a new field ;)

Borgs8472 03-19-2005 11:57 AM

Sorry, I'm still not following. I do understand you stick the if statement around the code in question.

Where do the options for user selection then become avalible? :(

Borgs8472 03-23-2005 06:13 PM

Sorry for bumping this up, but this seems such an easy thing to do... yet I'm lost :(

Borgs8472 03-25-2005 05:23 PM

Really sorry for bumping my thread yet again, but I wrapped a conditional around my statement and did -not- find an option suddenly appear? What on earth am I doing wrong?

Jolten 03-25-2005 05:47 PM

You must add a profile field (via the admin cp) so the user can have the option to select. That's the fieldn that filburt referred to.

Borgs8472 03-25-2005 11:04 PM

oooh, I will give it a go...

Borgs8472 07-09-2005 12:03 PM

Is this valid code then?

Code:

<if condition="$bbuserinfo['field15']">
    <!-- code if "Show forum category icons" is checked -->
</if>

<if condition!="$bbuserinfo['field15']">
    <!-- code if "Show forum category icons" isn't checked -->
</if>

:/

Cause I'm getting a parse error :(

Borgs8472 07-14-2005 04:47 PM

I thought I understood the principles, yet no joy :(

Kirk Y 07-19-2005 01:38 AM

When you add a Custom Profile field, each user then has the ability to set his/her preference for that particular field in their UserCP. Use <if> conditionals to show/hide the code. Find your Category Icons' html in the forumdisplay template (I'm assuming this is where your Category Icons are.) and wrap the <if> conditionals around that specific html. The bbuserinfo['field15'] checks if the user viewing that template has field15 set to a certain option and if the user has Yes selected, the category icons will show, if the user has No selected, the category icons will not show. See code below:

PHP Code:

<if condition="$bbuserinfo[field15] == 'No'">
<!-- 
code if "Show forum category icons" is checked -->
</if> 

The no IS case sensitive, so be sure you type it out right. If you need additional help, just ask.

Borgs8472 09-10-2005 08:03 PM

I finally did this! :banana:

Kirk Y 09-11-2005 03:08 AM

Ha ha... good to hear.


All times are GMT. The time now is 08:06 PM.

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.01417 seconds
  • Memory Usage 1,744KB
  • 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
  • (1)bbcode_code_printable
  • (1)bbcode_html_printable
  • (1)bbcode_php_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (14)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