Log in

View Full Version : How to make a simple 'option'


Borgs8472
03-17-2005, 09:52 PM
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
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:

<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?

<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:

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