View Full Version : VB IF with custom field
thenashy
12-22-2013, 10:28 AM
I'm not very familiar with VB IF statements. I don't even know if I'm calling it the right thing. However, I do remember using an example I found on here some time ago to make text appear only for a certain usergroup.
I'm wondering if it is possible to link this with a custom field.
Basically, I want to be able to allow the user to select if they want avatars on or off, on a particular template.
Any help would be greatly appreciated.
Lynne
12-22-2013, 04:10 PM
If you set up a custom user field (fieldx) and then if you want to turn off avatars if that is set to yes, then you could just write a plugin to do it or you could modify the template to do it. Something like:
<if condition="$bbuserinfo['fieldx'] == 'yes'">
stuff
</if>
ozzy47
12-22-2013, 04:18 PM
That would be:
<vb:if condition="$bbuserinfo['fieldx'] == 'yes'">
stuff
</vb:if>
Lynne
12-22-2013, 04:43 PM
Whoops, Ozzy is correct. For some reason I thought I was in the vB3 forum, not the vB4 forum.
thenashy
12-22-2013, 08:58 PM
Thanks guys. I'll give it a go!
--------------- Added 1387754786 at 1387754786 ---------------
Hi guys,
I tried the above with no luck. Can you see if I've done something wrong here?
<p>
<vb:if condition="$bbuserinfo['field19'] == 'On'"><a></a>
<vb:else />
<vb:if condition="$show['avatar'] AND $post['avatarurl']">
<img src="{vb:raw post.avatarurl}" alt="{vb:rawphrase xs_avatar, {vb:raw post.username}}" />
<vb:else />
<img src="{vb:stylevar imgdir_misc}/unknown.gif" />
</vb:if>
</vb:if>
</p>
</a>
--------------- Added 1387756942 at 1387756942 ---------------
I got it to work by taking out the else statement and only using the conditional.
Thanks very much guys, appreciate it!
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.