View Full Version : Switches
Hell Bomb
01-05-2010, 02:16 AM
Hello, can anyone provide information on how to allow someone to adjust settings such as I want to allow uses to be able to go into the usercp and allow them to turn on and off the shout box. How can i do this, i want individual users to be able to set it.
Mythotical
01-05-2010, 02:39 AM
You setup a profile field to reflect yes/no response/drop down. Then surround your shoutbox code with this:
<if condition="field[X] == 0">
// Shoutbox code here
</if>
X is the field id from the new profile field you just added. I also assume you are familiar with vBulletin. If you need more direct instructions just let me know.
The == 0 means if they have it set to NO then it will show, otherwise it won't. I can't remember if it should be:
$field['X'] OR $field[X]
Hell Bomb
01-05-2010, 11:51 PM
Yea more instructions would be nice, also, will this remember the change on the users account or on the computer, because i want there change to allow them to log into any computer as long as its on there users account it will remember the decision, Im more of a html/css guy, which is why i like making custom themes.
Mythotical
01-06-2010, 04:44 PM
Yes if they save the option no matter what computer they login from it will stay whatever they choose until they change it.
Ok follow these instructions:
Go to AdminCP > User Profile Fields > Add New User Profile Field > Single-Selection Menu (from drop down) > click Continue
Now on the next page:
1. Title - Give it an explanatory title in only a few characters such as: Turn On/Off Shoutbox
2. Description - Give a small description to explain what the option is for.
3. Leave "Profile Field Category" alone
4. Options: Enter the follow
Yes
No
5. Set Default: This I would leave as is.
6. Display Order: Leave this option alone
7. Field Required: Select whether the field is required to be changed when the person registers, updates their profile, etc. Or just leave as No
8. Field Editable by User: Leave this option alone
9. Private Field: Choose whether others can see if they have turned off shoutbox or not
10. Field Searchable on Member List: Set to 'No'
11. Show on Members List: set to 'No'
12. Option Input: Leave this entire area alone
13. Last box, choose what UserCP page to place the field on, probably leave as-is.
Click save and your done with that one part. Remember to take note of the Profile Field ID.
Now I'm not sure what shoutbox you have installed so all I can say is try to find where the code is for $shoutbox and then put this around it:
<if condition="$field[X] == '0'">
$shoutbox
</if>
Let me know if you need further assistance such as locating the shoutbox code.
Hell Bomb
01-06-2010, 06:19 PM
ahhh thank you very much i will try this when i get home
Mythotical
01-06-2010, 07:14 PM
NP, let me know how it goes.
Hell Bomb
01-06-2010, 10:48 PM
Still havn't gotten it to work. I followed the instructions carefully and nada. Checked each option twice, and entered the folowing code.
<if condition="$field[15] == '0'">
<!--{%SHOUTBOX%}-->
</if>
Mythotical
01-06-2010, 10:56 PM
Try this then:
<if condition="$field['15'] == '0'">
$shoutbox
</if>
This line means its commented out so make sure you have the right info.
<!--{%SHOUTBOX%}-->
Hell Bomb
01-06-2010, 11:18 PM
<!--{%SHOUTBOX%}-->
yea i know thats how its supposed to be, thats how inferno shout asks it to be displayed, it works without the /if statement but as soon as i put that around it it messes up. I know html/css like the back of my hand, php makes me dizzy xD anything entered within that if statement does not get displayed. I did check the usercp options and it does say "Yes"
mandingo
01-06-2010, 11:20 PM
Try this then:
<if condition="$field['15'] == '0'">
$shoutbox
</if>
This line means its commented out so make sure you have the right info.
<!--{%SHOUTBOX%}-->
Just popping in,would this work for vb4?
Hell Bomb
01-06-2010, 11:27 PM
not sure, started using vb4.0 yet
Mythotical
01-06-2010, 11:37 PM
Not sure mandingo but this may work:
<vb:if condition="$field['15'] == '0'">
$shoutbox
</if>
Hellbomb: Have you tried making sure you have the field set to No, if so try switching the 0 out for 1.
Hell Bomb
01-06-2010, 11:41 PM
Yep tried both things you have mentioned.
mandingo
01-07-2010, 12:08 AM
Not sure mandingo but this may work:
<vb:if condition="$field['15'] == '0'">
$shoutbox
</if>
Hellbomb: Have you tried making sure you have the field set to No, if so try switching the 0 out for 1.
Dint work,thanks for the help though.
Hell Bomb
01-07-2010, 12:44 AM
Dint work,thanks for the help though.
make sure you read the first post so you change the 15 to the id you use.
mandingo
01-07-2010, 01:08 AM
make sure you read the first post so you change the 15 to the id you use.
Ya,I changed the id # etc,tried a few different things,not a big deal,more of a future reference thing. Only know how to show output of text from a profile field in postbit,wanna learn other tweaks from there at some point. Thanks.didn't mean to hijack your thread.*apologizes*
Mythotical
01-07-2010, 05:19 PM
hellbomb, mandingo: I'm an idiot all around lol. Here is what you need to use.
<if condition="$bbuserinfo[field15] == 'No'">
Shoutbox code here
</if>
That will work.
Keep in mind if the field number does not match the number you are using then please change the field number.
Hell Bomb
01-18-2010, 04:14 AM
Thank you so much, just tested it and it works like a charm. If you ever need anything feel free to ask.
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.