![]() |
If custom field is set to x then do y
Hi, I have setup a radio button custom field. In my postbit template I'd like to add some code that shows a line of text next to each users post depending on what option they have selected in the custom field.
Basically the logic is: If the user who made this post has option 1 set then show [this piece of code]. If they have option 2 selected then show [this other piece of code]. Can anyone help me write that? |
It should be something like:
Code:
<vb:if condition="$post['fieldX'] == 1"> and of course you'd use the actual field number in place of X. |
Thanks for the quick response, I can't seem to get that code working though. Here's what I have:
A custom field, of 'single-selection radio button' type. It has three options 'one', 'two' and 'three. The code I added to my postbit template: PHP Code:
|
Oh, right. If the options are 'one', 'two' and 'three' then you have to check for those strings, like
Code:
<vb:if condition="$post['field13'] == 'one'"> Edit: also there's an elseif you can use, I changed the above to show how you'd use it. |
Ah, sorry I should have been clearer from the start. I also noticed I'd nested my if statements incorrectly. The final snippet I used looks like:
PHP Code:
|
All times are GMT. The time now is 11:38 PM. |
Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|