View Full Version : Using custom profile field contents in condition
Cadellin
01-15-2011, 11:02 AM
I want to create a custom permission for my members to allow them to hide their instant messaging information if they select a radiobutton.
So my question is if I have two radio buttons (Yes/No) called field9 how can I use that in a condition to hide or show content?
I understand about vB conditionals but I always know I can't use vb:raw in a conditional - so how can I do it?
Thanks in advance
Lynne
01-15-2011, 04:20 PM
Depends on what template you are using it in. If the variable is called $variable, then you would do something like:
<vb:if condition="$variable['field9'] == 'Yes'">whatever if it is Yes</vb:if>
Cadellin
01-15-2011, 04:34 PM
Thanks Lynne, you are once again very helpful as you have in the past :)
How could I find out the name of the variable required though? It would be put into the memberinfo, postbit and member list templates.
Lynne
01-15-2011, 05:18 PM
You'd look in the template. For instance, in the postbit template, the variable is called $post.
Cadellin
01-15-2011, 06:17 PM
Thanks Lynne for your help. Hopefully I'm sorted now :)
EDIT:
Probably a daft question but is there a variable I can use to determine whether the user viewing the profile is the profile owner? I have searched but I'm not quite sure what I should be searching for if you see what I mean.
Lynne
01-15-2011, 06:30 PM
if $variable['userid'] == $bbuserinfo['userid']
$bbuserinfo['userid'] is you, the viewer, and then compare it to the variable userid.
Cadellin
01-15-2011, 08:26 PM
Thanks Lynne - Now I know for the future!
Honestly your a saint :)
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.