The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
![]()
I'm trying to set a simple conditional to allow my members to enable/disable a sidebar based on usergroup permissions.
I have a CPF (field18), Single-Selection Radio Buttons, with the options being "Yes" and "No". In the user's profile options page, is an option: "Display the sidebar? (o) Yes ( ) No". If the YES button is checked, I want a conditional to display the respective code. From what I can tell by hunting around vb.com, this should work: <if condition="$post[field18] == 'Yes'"> But it doesn't. :\ What would the proper yes/no (or on/off) conditional syntax be? Thanks! |
#2
|
||||
|
||||
![]()
What template are you using that condition in? I think that particular one - $post[field18] - is only available on the showthread page (and, I think it has to do with the poster, not the viewer, and you want the viewer, yes?). Have you tried $vbulletin->userinfo[field18] ?
|
#3
|
|||
|
|||
![]()
That first part would certainly explain a lot, this is driving me nuts.
So what you're saying is: <if condition="$userinfo[field18] == 'Yes'"> Correct? /me goes off to try that |
#4
|
|||
|
|||
![]()
The values are returned as 1 and 2, it's a number that is returned, not the text.
HTML Code:
</fieldset><fieldset class="fieldset"> <legend>test</legend> <table cellpadding="0" cellspacing="3" border="0" width="100%"> <tr> <td>test</td> </tr> <tr> <td> <table cellpadding="2" cellspacing="0" border="0"> <tr><td valign="top"><label for="rb_cpf_field10_1"><input type="radio" name="userfield[field10]" value="1" id="rb_cpf_field10_1" checked="checked" />yes</label></td></tr><tr><td valign="top"><label for="rb_cpf_field10_2"><input type="radio" name="userfield[field10]" value="2" id="rb_cpf_field10_2" />no</label></td></tr> </table> <input type="hidden" name="userfield[field10_set]" value="1" /> </td> </tr> </table> </fieldset> ![]() |
#5
|
|||
|
|||
![]()
This is what I tried, which didn't do it. I'm doing it on Forumhome:
Code:
<if condition="THIS_SCRIPT == 'index'"> <if condition="$userinfo[field18] == 'Yes'"> |
#6
|
||||
|
||||
![]() Quote:
HTML Code:
<if condition="$vbulletin->userinfo[field13] <> 'Yes'"> stuff for when it isn't set to Yes </if> |
#7
|
|||
|
|||
![]() Quote:
Code:
<if condition="THIS_SCRIPT == 'index'"> <if condition="$userinfo[field18] == '1'"> --------------- Added [DATE]1223488271[/DATE] at [TIME]1223488271[/TIME] --------------- Quote:
![]() --------------- Added [DATE]1223488339[/DATE] at [TIME]1223488339[/TIME] --------------- While I'm at it (though I should probably start a new thread) - how would I go about setting usergroup permissions on my shiny new on/off CPF? ![]() |
#8
|
|||
|
|||
![]()
You need a hook after the userinfo is sorted out, yes.
Ok, it's passed from the form as 1 and 2 and stored for comparison in the field as the text, so go with that when comparing. Secondly. until you go to the profile page and click yes, the field will be blank. eg, the comparison will always fail. |
#9
|
||||
|
||||
![]() Quote:
![]() Quote:
HTML Code:
<if condition="$vbulletin->userinfo[field18] == 'Yes' AND is_member_of($bbuserinfo,5,6)"> stuff for users who said Yes in field 18 and are members of usergroup 5 or 6 </if> |
#10
|
|||
|
|||
![]() Quote:
![]() |
![]() |
Thread Tools | |
Display Modes | |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|